LINQ to SQL动态Context +动态表类? [英] LINQ to SQL dynamic Context + Dynamic Table Class?
问题描述
您好,
我正在尝试学习LINQ to SQL的工作原理。
到目前为止它看起来确实如此我需要什么,但在工作中我经常有以下情况:
开发PC有一个默认数据库,例如一个名为tTable1的表,价格和客户列。
客户PC具有相同的数据库,但是例如一个名为tTable1(同名)和列Price,Customer+UserdefinedColumn1,UserdefinedColumn2的表。
切换 DataContext
连接我想我必须做这样的事情: http://steveclements.net/blog/Dynamic-connection-for-LINQ-to-SQL havenContext [ ^ ]
但是自定义字段呢?表中,类不包含它们作为属性?如何查询它们?
我可以在这种情况下使用LINQ to SQL,还是需要使用LINQ to Dataset以便我可以读取自定义字段在数据集中?
欢迎任何建议或链接。
谢谢
Hello,
I am trying to learn how LINQ to SQL works.
So far it seems like it''s exactly what I need, but at work I do often have the following scenario:
The development PC has a default database with e.g. a table named "tTable1", Columns "Price" and "Customer".
The Customer PC has the same database but with e.g. a Table named "tTable1" (same name) and Columns "Price", "Customer" + "UserdefinedColumn1","UserdefinedColumn2".
To switch DataContext
connection I think I will have to do something like this: http://steveclements.net/blog/Dynamic-connection-for-LINQ-to-SQL-DataContext[^]
But what about the Custom Fields in the Table, the class does not contain them as property? How can I "query" them?
Can I use LINQ to SQL in this scenario or do I need to use LINQ to Dataset so that I can read the custom Fields in a dataset?
Any suggestions or links welcome.
Thank you
推荐答案
在这种情况下,我不知道Linq可以帮助你的方式。
你需要坚持现有的方式或者研究动态SQL。
说实话吧''更多的情况是,如果它的工作原理不能解决它!
Hi,
In this case I don''t know of a way that Linq can help you.
You either need to stick to your current way or look into dynamic SQL.
To be honest it''s more of a case that if it works don''t fix it!
这篇关于LINQ to SQL动态Context +动态表类?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!