Querying data using Entity Framework from dynamically created table

前端 未结 2 1759
孤独总比滥情好
孤独总比滥情好 2020-12-01 13:40

TLDR; How do I read data from a table using Entity Framework, when the table name isn\'t known at compile-time?

There is an external system that pro

2条回答
  •  我在风中等你
    2020-12-01 14:13

    Try this; :)

    string tableName = "MyTableTest";
    
    // Fetch the table records dynamically
    var tableData = ctx.GetType()
                    .GetProperty(tableName)
                    .GetValue(ctx, null);
    

提交回复
热议问题