InsertOnSubmit equivalent in DbContext.DbSet using Entity Framework 4 code first

后端 未结 2 596
情话喂你
情话喂你 2021-01-12 06:06

I am using entity framework code first approach, and I am building a generic Repository class that provides data access. In this class I want an Add(T entity) m

2条回答
  •  无人共我
    2021-01-12 06:38

    Add a generic constraint to your repository class:

    public class Repository where TEntity : class
    

提交回复
热议问题