Getting DbSet from a string

前端 未结 1 1260
长情又很酷
长情又很酷 2021-01-15 11:48

ADO.NET user trying EF for the first time. I\'m trying to get a table from a string of the table name.. Harder than I presumed. Basiclly I\'m here:

var tabl         


        
1条回答
  •  孤街浪徒
    2021-01-15 12:52

    I was looking for the same thing. Try the non-generic version of Set():

    var tableName = "Name.Entities.Measure" + measureType;
    var type = Type.GetType(tableName);
    var dbset = Context.Set(type);
    

    0 讨论(0)
提交回复
热议问题