本文整理汇总了C#中IDatabase.Attach方法的典型用法代码示例。如果您正苦于以下问题:C# IDatabase.Attach方法的具体用法?C# IDatabase.Attach怎么用?C# IDatabase.Attach使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDatabase
的用法示例。
在下文中一共展示了IDatabase.Attach方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: Connect
public void Connect()
{
if (Charset.GetCharset(_options.Charset) == null)
{
throw new FbException("Invalid character set specified");
}
try
{
_db = ClientFactory.CreateDatabase(_options);
_db.Charset = Charset.GetCharset(_options.Charset);
_db.Dialect = _options.Dialect;
_db.PacketSize = _options.PacketSize;
DatabaseParameterBuffer dpb = BuildDpb(_db, _options);
if (_options.FallIntoTrustedAuth)
{
_db.AttachWithTrustedAuth(dpb, _options.DataSource, _options.Port, _options.Database);
}
else
{
_db.Attach(dpb, _options.DataSource, _options.Port, _options.Database);
}
}
catch (IscException ex)
{
throw new FbException(ex.Message, ex);
}
}
示例2: DbAccessLayer
/// <summary>
/// Create a DbAccessLAyer with exernal Strategy
/// </summary>
/// <exception cref="ArgumentNullException"></exception>
public DbAccessLayer(string fullTypeNameToIDatabaseStrategy, string connection, ILogger logger = null,
DbConfig config = null)
: this(logger, config)
{
if (string.IsNullOrEmpty(fullTypeNameToIDatabaseStrategy))
throw new ArgumentNullException("fullTypeNameToIDatabaseStrategy");
ResolveDbType(fullTypeNameToIDatabaseStrategy);
var database = GenerateStrategy(fullTypeNameToIDatabaseStrategy, String.Concat((object) connection));
Database = new DefaultDatabaseAccess();
Database.Attach(database);
DatabaseStrategy = database;
}