I using ActiveRecord to perform the CRUD and using
AutomaticTransactionManagement to control the transaction, for
example:
     [Transaction(TransactionMode.Requires)]
     public virtual void fun(Customer c)//Customer inherit from
ActiveRecordBase
     {
         c.Create();
         c.Update();
         //..other code
     }

     but now I want execute some sql, so ,I add a function in
Customer :
     public class Customer : ActiveRecordBase
     {
          //...CRUD function

          public static void UpdateAll(string columns, object
value)  // the new function
          {
            ISessionFactoryHolder sessionHolder =
ActiveRecordMediator.GetSessionFactoryHolder();
            ISession session = sessionHolder.CreateSession(typeof
(Customer));

            System.Data.IDbCommand command =
session.Connection.CreateCommand();
            command.CommandText = "update Customer set " + columns +
"=" + value;
            command.ExecuteNonQuery();
            sessionHolder.ReleaseSession(session);
          }
     }

     and a new business logic:
     [Transaction(TransactionMode.Requires)]
     public virtual void NewFun(Customer c)
     {
           //...other business logic
           Customer.UpdateAll("columnName", value);//this function
can't be control by AutomaticTransactionManagement, and throw
                                                                         //
a Exception
          //..other business logic
     }
     Is AutomaticTransactionManagement only control the transaction in
ActiveRecord's object's CRUD performs? how can I do to let UpdateAll
in control??


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Castle Project Users" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to 
[email protected]
For more options, visit this group at 
http://groups.google.com/group/castle-project-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to