我习惯使用JavaScript,你可以使用类似的字符串访问对象的属性:
myObject[propertyNameString]
如何对我的查询实体数据库执行此操作:
Dim query = From q In db[tableName]
Where q[columnName] = myValue
Select z
答案 0 :(得分:1)
以下是我实际解决这个问题的方法:
Dim tableName As String = "myTable" 'Set "myTable" dynamically in for loop
Dim tableObjectType As Type = Type.GetType(tableName)
Dim result = dbContext.Set(tableObjectType).Find("myPrimaryKey") 'Also set dynamically