Click here to view and discuss this page in DocCommentXchange. In the future, you will be sent there automatically.

SQL Anywhere 11.0.1 (中文) » SQL Anywhere 服务器 - 编程 » SQL Anywhere 数据访问 API » SQL Anywhere .NET 2.0 API 参考 » iAnywhere.Data.SQLAnywhere 命名空间 (.NET 2.0)

 

SAFactory 类

表示一组方法,这些方法用于创建 iAnywhere.Data.SQLAnywhere 提供程序对数据源类实现的实例。此类属于静态类,因此无法继承,也无法将其实例化。

语法
Visual Basic

Public NotInheritable Class SAFactory 
  Inherits DbProviderFactory
  Implements IServiceProvider
C#

public sealed class SAFactory : DbProviderFactory,
  IServiceProvider
注释

没有用于 SAFactory 的构造函数。

ADO.NET 2.0 添加了两个新类 DbProviderFactories 和 DbProviderFactory,以简化提供程序无关代码的编写。要将它们与 SQL Anywhere 配合使用,请将 iAnywhere.Data.SQLAnywhere 指定为传递给 GetFactory 的提供程序无关名。例如:

' Visual Basic
Dim factory As DbProviderFactory = _
  DbProviderFactories.GetFactory( "iAnywhere.Data.SQLAnywhere" )
Dim conn As DbConnection = _
  factory.CreateConnection()
// C#
DbProviderFactory factory = 
        DbProviderFactories.GetFactory("iAnywhere.Data.SQLAnywhere" );
DbConnection conn = factory.CreateConnection();

在此示例中,以 SAConnection 对象形式创建了 conn。

有关 ADO.NET 2.0 中提供程序工厂和通用编程的说明,请参见 [external link] http://msdn2.microsoft.com/zh-cn/library/ms379620.aspx

Restrictions: 无法在 .NET Compact Framework 2.0 中使用 SAFactory 类。

Inherits: [external link] DbProviderFactory

另请参见

SAFactory 成员
Instance 字段
CanCreateDataSourceEnumerator 属性
CreateCommand 方法
CreateCommandBuilder 方法
CreateConnection 方法
CreateConnectionStringBuilder 方法
CreateDataAdapter 方法
CreateDataSourceEnumerator 方法
CreateParameter 方法
CreatePermission 方法