I've a table structure similiar to the one below:
Code:
CREATE TABLE [dbo].[Blogs] (
[blog_id] [int] IDENTITY (1, 1) NOT NULL ,
[blog_name] [varchar] (50) NULL ,
) ON [PRIMARY]
CREATE TABLE [dbo].[Posts] (
[post_id] [int] IDENTITY (1, 1) NOT NULL ,
[post_title] [varchar] (50) NULL ,
[post_blogid] [int] NULL ,
) ON [PRIMARY] TEXTIMAGE_ON [PRIMARY]
Class Blog has a Set of posts which is defined as inverse=true.
Right now when I add a new post to the Posts collection on a Blog it's not being saved unless I explicity tell the session to save it.
What I want to happen is that if I add to the set of posts, it would save automatically.
The idea is for cases similar to this one:
Code:
using (ISession seesion = factory.CreateSession())
{
Blog blog = session.Load(typeof(Blog),1);
blog.Posts.Add(new Post());
}
Is it possible to do this?