Entity Framework Core 1.1.2's DbSet implementation

798 views Asked by At

I am writing a new database provider for Entity Framework Core 1.1.2 (with target framework: .NET 4.5.2), and I have a very frustrating issue. My relevant installed NuGet packages are:

  • Microsoft.EntityFrameworkCore
  • Microsoft.EntityFrameworkCore.Relational
  • Microsoft.EntityFrameworkCore.SqlServer

I have a MyDbSet class which inherits from Microsoft.EntityFrameworkCore.DbSet:

public class MyDbSet<TEntity> : DbSet<TEntity> where TEntity : class {
}

I have a context class which is as simple as:

public class MyContext : DbContext {
    public MyDbSet<MyOtherModel> Others { get; set; }

    // Constructor
    public MyModel() {
        others = new MyDbSet<MyOtherModel>();
    }
}

I instantiate a MyContext object,

MyContext myContext = new MyContext();

and I want to do the following:

myContext.Others.Add(new MyOtherModel());

Here I receive an exception saying that the Add method is unimplemented.

Seeing the EF Core documentations, DbSet really is an abstract class with abstract, unimplemented methods. Is it right? Should I really write my own DbSet implementation? Or is there a default implementation of it somewhere? If so, which assembly / NuGet package do I need to access this?

0

There are 0 answers