我对 .Net 数据提供程序和 ADO.Net 的概述是否正确?
最近,我必须输入一些有关 .net 数据提供程序和 ado.net 的文档。我正在尝试获取有关我的发现的反馈。请审查并提出更正或意见。
总结 这是用于与数据库交互的基本 .Net API 的高级摘要。作为一名主要具有 Java 和 PHP 背景的开发人员,我不清楚 ADO.Net 与 OleDb 有何关系,而且我不知道“.Net 数据提供程序”一词的含义。我创建这个是因为 msdn 文档主要关注 ADO.Net,并且没有清晰地描述许多命名空间、接口和类如何交互。
.Net 数据提供程序
- http://msdn.microsoft.com/en-us/library/a6cd7c08(v=VS.71).aspx
- .NET Framework 数据提供程序是 用于连接到数据库, 执行命令并检索 结果。这些结果要么是 直接加工,或放入 ADO.NET 数据集。
- 这实际上意味着 .Net 数据提供者实现了 System.Data中定义的接口 命名空间。
- .Net 数据提供者类似于 Java 中的 JDBC 驱动程序
System.Data
- http: //msdn.microsoft.com/en-us/library/system.data.aspx 该页面包含的文本使 您认为 ADO.Net 是核心 .Net 数据访问的一部分,但是 事实上,ADO.Net 是 最高级别的数据访问,并且是 基于 .Net 数据提供者构建 实现中的接口 系统.数据。
- 在我看来,这几乎就像 微软正试图隐藏如何 数据库连接有效,因此 用户被控件困住 由视觉工作室提供。这 System.Data 命名空间包含 需要定义的接口 所有 .Net 数据提供程序
System.Data 核心接口
- IDbConnection
- IDbCommand
- IDataAdapter
- IDataReader
System.Data 实现示例
- 以下命名空间包括类 实现核心“.Net Data Provider”接口定义在 System.Data
- System.Data.SqlClient
- System.Data.OleDb
- System.Data.Odbc
- IBM.Data.DB2
- ByteFX.Data.MySqlClient
ADO.Net
- http://msdn.microsoft.com/en-us/library/27y4ybxw(v=VS.71 ).aspx
- ADO.Net是一个数据库查询和 建立在之上的操作API 基本的.Net 数据提供程序类。 ADO.Net 专注于断开连接、 多层数据库交互。
- 我认为核心是 ADO.Net 类应该在单独的 像 System.Data.ADO 这样的命名空间 为了清楚起见。
ADO.Net 核心类
- DataSet
- DataTable
- DataColumn
- DataRelation
Recently I had to type up some documentation on .net data providers and ado.net. I am trying to get feedback on my findings. Please review and provide corrections or opinions.
Summary
This is a high level summary of the basic .Net API’s for interacting with a database. As a developer with mainly a Java and PHP background I was unclear about how ADO.Net related to OleDb and I had no idea what was meant by the term “.Net Data Provider”. I created this because the msdn documentation is HEAVILY focused on ADO.Net and does not give a clear picture of how the many namespaces, interfaces, and classes interact.
.Net Data Provider
- http://msdn.microsoft.com/en-us/library/a6cd7c08(v=VS.71).aspx
- A .NET Framework data provider is
used for connecting to a database,
executing commands, and retrieving
results. Those results are either
processed directly, or placed in an
ADO.NET DataSet. - What that actually means is that a
.Net Data Provider implements the
interfaces defined in the System.Data
namespace. - A .Net Data Provider is similar to a
JDBC driver in Java
System.Data
- http://msdn.microsoft.com/en-us/library/system.data.aspx
This page contains text that makes
you believe that ADO.Net is the CORE
part of .Net data access, however the
reality is that ADO.Net is the
highest level of data access and is
built upon the .Net Data Providers
that implement the interfaces in the
System.Data. - In my opinion it almost seems like
microsoft is trying to hide how
database connections work, so that
users are trapped using controls
provided by visual studio. The
System.Data namesapce contains
Interfaces that need to be defined by
ALL .Net Data Providers
System.Data Core Interfaces
- IDbConnection
- IDbCommand
- IDataAdapter
- IDataReader
Examples of System.Data Implementations
- The following namespaces include classes
that implement the core “.Net Data
Provider” interfaces defined in
System.Data - System.Data.SqlClient
- System.Data.OleDb
- System.Data.Odbc
- IBM.Data.DB2
- ByteFX.Data.MySqlClient
ADO.Net
- http://msdn.microsoft.com/en-us/library/27y4ybxw(v=VS.71).aspx
- ADO.Net is a database query and
manipulation API built on top of the
basic .Net Data Provider classes.
ADO.Net focuses on disconnected,
multi-tier database interaction. - In my opinion the core ADO.Net
classes should be in a separate
namespace like System.Data.ADO just
for the sake of clarity.
ADO.Net Core Classes
- DataSet
- DataTable
- DataColumn
- DataRelation
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
System.Data 是一个“包”,其中包含与 .NET 中的“数据提供程序”一起使用的所有内容。确实,ADO 是处理数据的一种策略,但它是 .NET 中的主要策略。
ADO 较少涉及特定的数据库技术(因为它不一定是特定于数据库的技术),而更多地涉及数据关系。术语:集合、表、列、行和关系是很好理解的建模术语,ADO.NET 使它们成为 .NET 空间中的一流对象。
数据提供程序提供低级实现特定细节以支持核心 ADO.NET 概念(表、行等),旨在抽象出如何连接到数据提供程序的直接实现细节。例如,您应该能够以相对较少的努力将 Jet Data 提供程序替换为 Oracle Data 提供程序,就 DataTables、DataRows 和 DataColumns(除了查询详细信息)而言,这样您的代码受以下因素的影响最小:改变。为什么这很重要?因为这意味着您可以使用具有相似命令语义的非同质数据源(即您可以在同一应用程序中使用相同对象使用 Excel 电子表格和 MySql 数据库)。这使得重用和重新利用变得非常容易和直接。
作为一般视图,您可以这样考虑系统:
希望有所帮助。
System.Data is the "package" that contains everything for working with "Data providers" in .NET. It is true that ADO, is one strategy for working with data, but it is the primary strategy in .NET.
ADO is less about specific DB technologies (as it is not necessarily meant to be a database specific technology) and more about data relationships. The terms: Set, Table, Column, Row and Relationship are well understood modeling terms and ADO.NET makes them first class objects in the .NET space.
Data providers provide low-level implementation specific details for supporting the core ADO.NET concepts (tables, rows, etc) and are meant to abstract away the direct implementation details of how to connect to a data provider. For instance, you should be able to, with relatively little effort, swap out a Jet Data provider, with a Oracle Data provider, in terms of DataTables, DataRows, and DataColumns (query details aside) such that your code is minimally impacted by the change. Why is this important? Because it means you can work with non-homogenous data sources with similar command semantics (i.e. you can work with excel spreadsheets and MySql dbs in the same app with the same objects). This makes reuse and repurposing very easy and very straight-forward.
As a general view you can think of the system this way:
Hope that helps.
参考:
第三方提供商的存在并不支持微软试图“诱骗”我们的想法。
隐藏“数据库连接如何工作”是一种抽象,并不具有颠覆性。
In reference to:
The existence of 3rd party providers does not support the idea that MS is trying to "trap" us into anything.
Hiding "how database connections work" is a kind of abstraction, and is not subversive.