i am trying to update record with nHibernate. I tried several solutions, but none of them work (shows no error, bu data is alsno not updated).
First code:
MyRepository rep = new MyRepository(GetCurrentSession());
UserPost post = rep.GetById(id);
post.ValidTo = date;
rep.Update(post);
Second code:
ISession session = GetCurrentSession();
MyRepository rep = new MyRepository(GetCurrentSession());
UserPost post = rep.GetById(id);
post.ValidTo = date;
rep.Update(post);
session.Update(post);
session.Transaction.Commit();
session = null;
Maybe somedy has a suggestion?
Is
UserPostmapped correctly? Are you using.hbm.xmlfiles (note the hbm) and the xml file is marked as an embedded resource?In my experience if an entity is not mapped NHibernate doesn't complain nor throw an error.
Actually looking at your code in more detail you are not calling
session.Save