I have a many to many relation beetween Group and Content table in sql and i imperilment this with a junction table .it name is GroupContent .
when i try to insert a new Group and Content the Openaccess insert a Group and a Content and Dose not insert any record to my junction table. this is my code
using (Context orm = new Context ())
{
Group objGroup = new Group();
objGroup.GroupName = "group 1";
Content objContent = new Content();
objContent.ContentDetail = "content 1";
objGroup.Contents.Add(objContent );
orm.Add(objGroup );
orm.Add(objContent);
orm.SaveChanges();
}
Can i Use this to code with Entity Framework.
By default collection properties are not managed (persisted) in OpenAccess.
You need to mark the navigation member with IsManaged. Just open the designer, find the navigation property (in this case the Contents property of the Group class) and trough the Properties Pane, change the IsManaged to true.