Can entities be attached to an ISession that weren't previously attached?

Posted by TheCloudlessSky on Stack Overflow See other posts from Stack Overflow or by TheCloudlessSky
Published on 2011-01-05T17:52:54Z Indexed on 2011/01/05 17:53 UTC
Read the original article Hit count: 164

Filed under:
|

I'm playing around with NHibernate 3.0. So far things are pretty cool. I'm trying to attach an entity that wasn't detached previously:

var post = new Post(){ Id = 2 }
session.Update(post); // Thought this would work but it doesn't.
post.Title = "New Title After Update";
session.Flush();

Is this possible so that only Title gets updated? This is currently possible in EntityFramework. I'd like to not have to load Post from the database when I just need to update a few properties.

© Stack Overflow or respective owner

Related posts about c#

Related posts about nhibernate