开发者

How to create a C# class whose attributes are rows in a database table with ADO.NET?

开发者 https://www.devze.com 2023-04-03 06:47 出处:网络
Is it possible? Please note I am not usin开发者_运维问答g LINQ nor Entity Framework.You could also check out Dapper-Dot-Net - a very lightweight and very capable \"micro ORM\" which - incidentally -

Is it possible?

Please note I am not usin开发者_运维问答g LINQ nor 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.

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!


My personal favorite is done using the dynamic object featured in .NET4 via Rob Conery's Massive library. Like Dapper-Dot-Net it is small.


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.

http://msdn.microsoft.com/en-us/library/esbykkzb(v=VS.100).aspx

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号