You can use HQL's update and ExecuteUpdate(), see http://ayende.com/Blog/archive/2009/05/28/nhibernate-ndash-executable-dml.aspx
<http://ayende.com/Blog/archive/2009/05/28/nhibernate-ndash-executable-dml.aspx> -- Mauricio On Thu, Jul 15, 2010 at 3:39 PM, Niran Pravithana <[email protected]>wrote: > How can I update an object without selecting a record. > For example, > > [ActiveRecord(Lazy=true)] > public class AdminUser > { > ... > } > > using (var sess = new Castle.ActiveRecord.SessionScope()) > { > var user = > Castle.ActiveRecord.ActiveRecordMediator<Domain.AdminUser>.FindByPrimaryKey(11); > // > not yet select > user.Username = "Admin"; //select from database > System.Console.WriteLine("SET"); > System.Console.ReadLine(); > > Castle.ActiveRecord.ActiveRecordMediator<Domain.BaseUser>.Save(user); // > update to database > } > System.Console.WriteLine("OK"); > System.Console.ReadLine(); > > I don't want the code to select from database everytime I set value to > a property, since it effects the performance of the application, how > can I write the code to just update only some property and leave those > remaining untouched? > > -- > 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]<castle-project-users%[email protected]> > . > For more options, visit this group at > http://groups.google.com/group/castle-project-users?hl=en. > > -- 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.
