简体   繁体   English

如何使用ADO.NET创建属性为数据库表中行的C#类?

[英]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.

相关问题 如何使用ADO.Net C#将null插入到sql数据库中 - how to insert null into sql database with ADO.Net C# 如何使用 ADO.NET 创建数据库触发器 - How to create a database trigger with ADO.NET 如何从存储过程返回表中的多行并使用 ADO.NET 在 C# 中访问这些值? - How to return table multiple rows from a stored procedure and access those values in C# using ADO.NET? ADO.net如何使用C#和连接的模型在页面加载时将特定数据库表单元格中的数据绑定到转发器控件上? - ADO.net how to bind data from specific database table cell to a repeater control on page load using C# & the connected model? 我可以使用ADO.NET和C#在MS SQL Express 2014 LocalDB中创建表吗? - Can I create table in MS SQL Express 2014 LocalDB using ADO.NET and C#? 在ADO.Net C#中执行并行数据库访问 - Execute parallel database access in ADO.Net C# 将更改保存到数据库 C# ADO.NET - save changes to database C# ADO.NET C#ADO.NET-返回表中一列的和 - C# ADO.NET - return sum of one columns in table 使用 PostgreSql 和 ADO.NET 在 C# WinForms 中锁定记录和表 - Record and Table locking in C# WinForms with PostgreSql and ADO.NET 如何在ASP.NET C#的帮助器类中使用Ado.net模型 - How to Use Ado.net Model in Helper Class in asp.net c#
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM