Generic Repository in C# Using Entity Framework

后端 未结 2 1527
清歌不尽
清歌不尽 2020-12-11 21:31

I want to retrieve multiple records by giving array of primary key and I have to make generic method of it for all the entities.

private DbSet         


        
2条回答
  •  轮回少年
    2020-12-11 21:58

    You can have different names in your application model and your database model. You will have to map your Model Ids to the name in database:

    In your Mapping you will have something similar to this for every entity: this.Property(t => t.Id).HasColumnName("ProductId");

提交回复
热议问题