对象到 DataView 或 DataSet 或 DataTable 并返回到对象
我们有一个混合应用程序,其遗留模块仍然使用 DataSets、DataViews 和 DataTables,但是我们拥有除此模块的 DB 之外的大多数数据库 ORMed。我想知道是否有人可以指导我如何构建扩展,就像
/* generates a dataset called CustomerDS with
DataTable called Customer uses property names as DataColumn name */
var dataset =_customer.AsDataSet();
/* Converts the dataset to required object or
throws exception if its cant convert*/
var customerEntity = _dataset.ToObject<Customer>();
我不知道我们什么时候有时间在应用程序的其他层上工作并将其从数据集中释放出来一样。我可能听起来很疯狂,但这只是一个想法。当我需要支持/修复该应用程序的错误时,我会做噩梦。
We have a mish-mash app with a legacy module that still uses DataSets, DataViews and DataTables however we have most of the the databases ORMed except the DB for this Module. I was wondering if someone could give me pointers as to how to go about building extensions like
/* generates a dataset called CustomerDS with
DataTable called Customer uses property names as DataColumn name */
var dataset =_customer.AsDataSet();
/* Converts the dataset to required object or
throws exception if its cant convert*/
var customerEntity = _dataset.ToObject<Customer>();
I dont know when we will get time to work on other layers of the app and free it from DataSets. I might sound crazy but its just a thought. I get nightmares when i need to support/bug fix that app.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
您可以使用反射,例如:
You can use a reflection for example:
您可以使用它从数据表中获取对象
并像这样使用它
You can use this to get object from data table
and use it like this