Hello, languanghao, Did you solve your issue?? I've the same problem.
On Wed, Jan 12, 2011 at 9:46 PM, languanghao <[email protected]> wrote: > Hi, > > I used Castle.Facilities.AutoTx in my program, but it didn't work. > > Code: > namespace BLL.IMPL.User > { > [Transactional] > public class UserInfoManagerIMPL : InitializingCastle, > IUserInfoManager > { > > [Transaction(Castle.Services.Transaction.TransactionMode.Requires)] > public virtual bool AddUserInfo(UserInfo user) > { > ActiveRecordMediator<UserInfo>.Create(user); > throw new Exception("test"); > } > } > > This method throw an Exception,but the userinfo has commit. > > The unit test code: > public class TestUserInfo > { > [Test] > public void TestInsert() > { > IUserInfoManager uimanager = > ObjectFactory.Container.UserInfoManager; > UserInfo ui = new UserInfo(); > ui.LoginName = "test9"; > ui.LoginPassWord = "123@abc"; > ui.LastEditPassWordDate = DateTime.Now; > ui.BaseInfo = new UserBaseInfo { Gender = GenderEnum.Male, > UserName = "test1", User = ui }; > uimanager.AddUserInfo(ui); > } > } > > The UserInfo model: > namespace DAL.Model.User > { > [ActiveRecord(Lazy=true)] > public class UserInfo > { > public UserInfo() > { > IsEnabled = true; > IsLocked = false; > } > > [PrimaryKey(PrimaryKeyType.Guid)] > public virtual Guid SID { get; set; } > > [Property] > public virtual string LoginName { get; set; } > > [Property] > public virtual string LoginPassWord { get; set; } > > [Property] > public virtual DateTime LastEditPassWordDate { get; set; } > > [Property] > public virtual bool IsLocked { get; set; } > > [Property] > public virtual bool IsEnabled { get; set; } > > [OneToOne(Cascade = CascadeEnum.All)] > public virtual UserBaseInfo BaseInfo { get; set; } > } > > } > > -- > 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. > > -- 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.
