This is a migrated thread and some comments may be shown as answers.

[Solved] To Rollback for StoreProc

2 Answers 103 Views
General Discussions
This is a migrated thread and some comments may be shown as answers.
This question is locked. New answers and comments are not allowed.
may
Top achievements
Rank 1
may asked on 22 Oct 2010, 05:35 AM
Hi,

I'm trying to write a module that able to rollback the transaction when one of the strored procedure failed. The code below is one of the example:

Database database = Database.Get("DBSample");
                database.Properties.TransactionProvider = TransactionProvider.TransactionScope;

                using (IObjectScope scope = database.GetObjectScope())
                {
                    // Transaction to modify object
                    using (TransactionScope txnScop = new TransactionScope())
                    {
                        using (MyDBContext dbContext = new MyDBContext())
                        {                          
                            object[] result =dbContext.Add_SalaryStoreProc("EmployeeName","1000");
                            object[] result =dbContext.Add_AnnualIncome("EmployeeName","1000");
                        }
                        txnScop.Complete();
                    }
                }
            }


I get the following exception:
{Telerik.OpenAccess.OpenAccessException: No metadata has been registered for class Salary. (This usually indicates, that either this class is not declared persistent or it is declared persistent but not enhanced. The class was loaded from file:///E:/Project/HR/Code/HR/bin/HR.DLL.)
   at Telerik.OpenAccess.RT.PersistentClassesRegistry.GetMeta(Object name, Type t)
   at Telerik.OpenAccess.RT.PersistentClassesRegistry.GetMeta(Type pcClass)
   at Telerik.OpenAccess.RT.PersistentClassesRegistry.GetFields(Type pcClass)
   at Telerik.OpenAccess.SPI.ConfigCollector.CreateClassConfig(Type type, PersistentAttribute pAttr)
   at Telerik.OpenAccess.SPI.ConfigCollector.ProcessAssembly(Assembly inputAssembly2)
   at Telerik.OpenAccess.SPI.ConfigCollector.Collect(IConfigBuilder cBuilder, IAssemblyProvider asmLoader, Hashtable alreadyProcessed, Boolean collectReferences)
   at Telerik.OpenAccess.SPI.ConfigCollector.Collect(IConfigBuilder cBuilder, IAssemblyProvider asmLoader, Boolean collectReferences)
   at Telerik.OpenAccess.RT.DatabaseAdapter.GetPersistentClassesConfig(ConfigManager configManager, List`1 jdoRootsArrayList)
   at Telerik.OpenAccess.RT.DatabaseAdapter.AssertPersistenceManagerFactory(String usr, String password, Boolean open)
   at Telerik.OpenAccess.RT.DatabaseAdapter.GetObjectScope(TransactionProvider provider)
   at Telerik.OpenAccess.RT.DatabaseAdapter.Telerik.OpenAccess.SPI.IDatabaseAdapter.GetObjectScope()
   at Telerik.OpenAccess.Database.GetObjectScope()

Does OpenAccess support rollback for stored procedure?

2 Answers, 1 is accepted

Sort by
0
may
Top achievements
Rank 1
answered on 22 Oct 2010, 08:21 AM
Besides, I have added the table of Salary to visual designer. i still see the same exception.
0
PetarP
Telerik team
answered on 27 Oct 2010, 05:57 PM
Hi may,

 Unfortunately roll backing a transaction is not supported. As for your problem it seems that your classes were not enhanced correctly. Can you please share more information regarding your model so that we can possibly identify the cause of your problem. 
We look forward to your reply.

Regards,
Petar
the Telerik team
Do you want to have your say when we set our development plans? Do you want to know when a feature you care about is added or when a bug fixed? Explore the Telerik Public Issue Tracking system and vote to affect the priority of the items
Tags
General Discussions
Asked by
may
Top achievements
Rank 1
Answers by
may
Top achievements
Rank 1
PetarP
Telerik team
Share this question
or