[英]How to create a C# class whose attributes are rows in a database table with ADO.NET?
Is it possible? 可能吗?
Please note I am not using LINQ nor Entity Framework. 请注意,我没有使用LINQ或Entity Framework。
You could also check out Dapper-Dot-Net - a very lightweight and very capable "micro ORM" which - incidentally - is used to run this site here. 您还可以查看Dapper-Dot-Net ,它是一种非常轻巧且功能强大的“微型ORM”,它可用于在此运行此站点。
It's quite fast, a single *.cs file, works with your usual T-SQL commands and returns objects - works like a charm, it's very fast, very easy to understand, no big overhead - just use it and enjoy! 它非常快,一个* .cs文件,可与您通常的T-SQL命令一起使用并返回对象-就像一个超级按钮一样,非常快,非常容易理解,没有大的开销-只需使用它即可享受!
My personal favorite is done using the dynamic object featured in .NET4 via Rob Conery's Massive library. 我个人最喜欢的是通过Rob Conery的Massive库使用.NET4中的动态对象来完成的 。 Like Dapper-Dot-Net it is small.
像Dapper-Dot-Net一样,它很小。
By going old school you can use Datasets to create strongly typed data table classes that mirror your database entirely right down to the relationships. 放学后,您可以使用数据集创建强类型数据表类,这些类完全将数据库镜像到关系。 It's a precursor to LINQ/EF that auto-generates a lot of bloated code but they're very handy for maintaining your field names, data types, data constraints and performing easily configured rapid updates.
它是LINQ / EF的前身,可自动生成大量of肿的代码,但它们对于维护字段名,数据类型,数据约束以及执行易于配置的快速更新非常方便。
http://msdn.microsoft.com/en-us/library/esbykkzb(v=VS.100).aspx http://msdn.microsoft.com/en-us/library/esbykkzb(v=VS.100).aspx
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.