本文整理汇总了C#中System.Data.SQLite.SQLiteConnection.SetChunkSize方法的典型用法代码示例。如果您正苦于以下问题:C# SQLiteConnection.SetChunkSize方法的具体用法?C# SQLiteConnection.SetChunkSize怎么用?C# SQLiteConnection.SetChunkSize使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类System.Data.SQLite.SQLiteConnection
的用法示例。
在下文中一共展示了SQLiteConnection.SetChunkSize方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: CreateOpenAndInitializeConnection
/// <summary>
/// Creates a new <see cref="SQLiteConnection"/> object, opens it and executes the
/// InitializationCommand via ExecuteNonQuery()
/// </summary>
/// <returns>Newly created and initialized <see cref="SQLiteConnection"/></returns>
private SQLiteConnection CreateOpenAndInitializeConnection()
{
var connection = new SQLiteConnection(_connectionString);
connection.Open();
connection.SetChunkSize(_settings.ChunkSizeInMegabytes * 1024 * 1024);
using (var command = new SQLiteCommand(_settings.InitializationCommand, connection))
command.ExecuteNonQuery();
return connection;
}
示例2: GetDatabaseConnectionSDS
private static IDbConnection GetDatabaseConnectionSDS(string cs)
{
var rv = new SQLiteConnection(cs);
if (rv == null) {
throw new ArgumentException("no connection");
}
rv.Open();
try {
rv.SetChunkSize(GROW_SIZE);
}
catch (Exception ex) {
LogManager.GetLogger(typeof (Sqlite)).Error(
"Failed to sqlite control", ex);
}
if (clearPool == null) {
clearPool = conn =>
{
SQLiteConnection.ClearPool(
conn as SQLiteConnection);
};
}
return rv;
}