I'm starting working with the Entity Framework 6 and got a problem with dynamic models. I have the following model:
public class EF6
{
public Guid Guid { get; set; }
public int Int2 { get; set; }
public string Str { get; set; }
public byte[] Doc { get; set; }
}
Which is added to the context like this:
Entities ent = new Entities();
var dbSet = ent.Set<EF6>();
EF6 e = new EF6();
e.Guid = Guid.NewGuid();
e.Int2 = 123;
e.Str = "Hello World";
e.Doc = new byte[1] { 0 };
dbSet.Add(e);
But on the dbSet.Add(e)
part, i get the following error: The entity type EF6 is not part of the model for the current context.
Does any one has an solution for this problem?
EDIT
Later i want to write some of my models in IronPython and add them over dbSet.Add
.
EDIT 2