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

SQL Anywhere 11.0.0 » SQL Anywhere Server - Programming » SQL Anywhere Data Access APIs » SQL Anywhere .NET 2.0 API Reference » iAnywhere.Data.SQLAnywhere namespace (.NET 2.0)


SAFactory class

Represents a set of methods for creating instances of the iAnywhere.Data.SQLAnywhere provider's implementation of the data source classes. This is a static class and so cannot be inherited or instantiated.

Visual Basic

Public NotInheritable Class SAFactory 
  Inherits DbProviderFactory
  Implements IServiceProvider

public sealed class SAFactory : DbProviderFactory,

There is no constructor for SAFactory.

ADO.NET 2.0 adds two new classes, DbProviderFactories and DbProviderFactory, to make provider independent code easier to write. To use them with SQL Anywhere specify iAnywhere.Data.SQLAnywhere as the provider invariant name passed to GetFactory. For example:

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

In this example, conn is created as an SAConnection object.

For an explanation of provider factories and generic programming in ADO.NET 2.0, see [external link]

Restrictions: The SAFactory class is not available in the .NET Compact Framework 2.0.

Inherits: [external link] DbProviderFactory

See also

SAFactory members
Instance field
CanCreateDataSourceEnumerator property
CreateCommand method
CreateCommandBuilder method
CreateConnection method
CreateConnectionStringBuilder method
CreateDataAdapter method
CreateDataSourceEnumerator method
CreateParameter method
CreatePermission method