本文整理汇总了C#中JET_INSTANCE类的典型用法代码示例。如果您正苦于以下问题:C# JET_INSTANCE类的具体用法?C# JET_INSTANCE怎么用?C# JET_INSTANCE使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
JET_INSTANCE类属于命名空间,在下文中一共展示了JET_INSTANCE类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: AbstractActions
protected AbstractActions(JET_INSTANCE instance, ColumnsInformation columnsInformation, string database, Guid instanceId)
{
logger = LogManager.GetLogger(GetType());
try
{
this.instanceId = instanceId;
ColumnsInformation = columnsInformation;
session = new Session(instance);
transaction = new Transaction(session);
Api.JetOpenDatabase(session, database, null, out dbid, OpenDatabaseGrbit.None);
queues = new EsentTable(session, new Table(session, dbid, "queues", OpenTableGrbit.None));
subqueues = new EsentTable(session, new Table(session, dbid, "subqueues", OpenTableGrbit.None));
txs = new EsentTable(session, new Table(session, dbid, "transactions", OpenTableGrbit.None));
recovery = new EsentTable(session, new Table(session, dbid, "recovery", OpenTableGrbit.None));
outgoing = new EsentTable(session, new Table(session, dbid, "outgoing", OpenTableGrbit.None));
outgoingHistory = new EsentTable(session, new Table(session, dbid, "outgoing_history", OpenTableGrbit.None));
recveivedMsgs = new EsentTable(session, new Table(session, dbid, "recveived_msgs", OpenTableGrbit.None));
}
catch (Exception)
{
Dispose();
throw;
}
}
示例2: ConfigureInstance
public InstanceParameters ConfigureInstance(JET_INSTANCE jetInstance, string path)
{
path = Path.GetFullPath(path);
var logsPath = path;
if (string.IsNullOrEmpty(configuration.Settings["Raven/Esent/LogsPath"]) == false)
{
logsPath = configuration.Settings["Raven/Esent/LogsPath"].ToFullPath();
}
var circularLog = GetValueFromConfiguration("Raven/Esent/CircularLog", true);
var logFileSizeInMb = GetValueFromConfiguration("Raven/Esent/LogFileSize", 64);
logFileSizeInMb = Math.Max(1, logFileSizeInMb / 4);
var instanceParameters = new InstanceParameters(jetInstance)
{
CircularLog = circularLog,
Recovery = true,
NoInformationEvent = false,
CreatePathIfNotExist = true,
EnableIndexChecking = true,
TempDirectory = Path.Combine(logsPath, "temp"),
SystemDirectory = Path.Combine(logsPath, "system"),
LogFileDirectory = Path.Combine(logsPath, "logs"),
MaxVerPages = TranslateToSizeInVersionPages(GetValueFromConfiguration("Raven/Esent/MaxVerPages", 512), 1024 * 1024),
PreferredVerPages = TranslateToSizeInVersionPages(GetValueFromConfiguration("Raven/Esent/PreferredVerPages", 472), 1024 * 1024),
BaseName = "RVN",
EventSource = "Raven",
LogBuffers = TranslateToSizeInDatabasePages(GetValueFromConfiguration("Raven/Esent/LogBuffers", 8192), 1024),
LogFileSize = (logFileSizeInMb * 1024),
MaxSessions = MaxSessions,
MaxCursors = GetValueFromConfiguration("Raven/Esent/MaxCursors", 2048),
DbExtensionSize = TranslateToSizeInDatabasePages(GetValueFromConfiguration("Raven/Esent/DbExtensionSize", 8), 1024 * 1024),
AlternateDatabaseRecoveryDirectory = path
};
return instanceParameters;
}
示例3: InitColumDictionaries
public void InitColumDictionaries(JET_INSTANCE instance, string database)
{
using (var session = new Session(instance))
{
var dbid = JET_DBID.Nil;
try
{
Api.JetOpenDatabase(session, database, null, out dbid, OpenDatabaseGrbit.None);
using (var usage = new Table(session, dbid, "usage", OpenTableGrbit.None))
UsageColumns = Api.GetColumnDictionary(session, usage);
using (var details = new Table(session, dbid, "details", OpenTableGrbit.None))
DetailsColumns = Api.GetColumnDictionary(session, details);
using (var pages = new Table(session, dbid, "pages", OpenTableGrbit.None))
PagesColumns = Api.GetColumnDictionary(session, pages);
using (var files = new Table(session, dbid, "files", OpenTableGrbit.None))
FilesColumns = Api.GetColumnDictionary(session, files);
using (var signatures = new Table(session, dbid, "signatures", OpenTableGrbit.None))
SignaturesColumns = Api.GetColumnDictionary(session, signatures);
using (var config = new Table(session, dbid, "config", OpenTableGrbit.None))
ConfigColumns = Api.GetColumnDictionary(session, config);
}
finally
{
if (Equals(dbid, JET_DBID.Nil) == false)
Api.JetCloseDatabase(session, dbid, CloseDatabaseGrbit.None);
}
}
}
示例4: StorageActionsAccessor
public StorageActionsAccessor(TableColumnsCache tableColumnsCache, JET_INSTANCE instance, string databaseName, UuidGenerator uuidGenerator, OrderedPartCollection<AbstractFileCodec> fileCodecs)
{
this.tableColumnsCache = tableColumnsCache;
this.uuidGenerator = uuidGenerator;
this.fileCodecs = fileCodecs;
try
{
session = new Session(instance);
transaction = new Transaction(session);
Api.JetOpenDatabase(session, databaseName, null, out database, OpenDatabaseGrbit.None);
}
catch (Exception original)
{
log.WarnException("Could not create accessor", original);
try
{
Dispose();
}
catch (Exception e)
{
log.WarnException("Could not properly dispose accessor after exception in ctor.", e);
}
throw;
}
}
示例5: DocumentStorageActions
public DocumentStorageActions(
JET_INSTANCE instance,
string database,
TableColumnsCache tableColumnsCache,
OrderedPartCollection<AbstractDocumentCodec> documentCodecs,
IUuidGenerator uuidGenerator,
IDocumentCacher cacher,
TransactionalStorage transactionalStorage)
{
this.tableColumnsCache = tableColumnsCache;
this.documentCodecs = documentCodecs;
this.uuidGenerator = uuidGenerator;
this.cacher = cacher;
this.transactionalStorage = transactionalStorage;
try
{
session = new Session(instance);
transaction = new Transaction(session);
Api.JetOpenDatabase(session, database, null, out dbid, OpenDatabaseGrbit.None);
}
catch (Exception)
{
Dispose();
throw;
}
}
示例6: ConfigureInstance
public void ConfigureInstance(JET_INSTANCE jetInstance, string path)
{
path = Path.GetFullPath(path);
var logsPath = path;
if (string.IsNullOrEmpty(configuration.Settings["Raven/Esent/LogsPath"]) == false)
{
logsPath = configuration.Settings["Raven/Esent/LogsPath"].ToFullPath();
}
new InstanceParameters(jetInstance)
{
CircularLog = true,
Recovery = true,
NoInformationEvent = false,
CreatePathIfNotExist = true,
TempDirectory = Path.Combine(logsPath, "temp"),
SystemDirectory = Path.Combine(logsPath, "system"),
LogFileDirectory = Path.Combine(logsPath, "logs"),
MaxVerPages = TranslateToSizeInDatabasePages(GetValueFromConfiguration("Raven/Esent/MaxVerPages", 128)),
BaseName = "RVN",
EventSource = "Raven",
LogBuffers = TranslateToSizeInDatabasePages(GetValueFromConfiguration("Raven/Esent/LogBuffers", 16)) / 2,
LogFileSize = GetValueFromConfiguration("Raven/Esent/LogFileSize", 16) * 1024,
MaxSessions = MaxSessions,
MaxCursors = GetValueFromConfiguration("Raven/Esent/MaxCursors", 2048),
DbExtensionSize = TranslateToSizeInDatabasePages(GetValueFromConfiguration("Raven/Esent/DbExtensionSize", 16)),
AlternateDatabaseRecoveryDirectory = path
};
}
示例7: HiLoVersionGenerator
public HiLoVersionGenerator(JET_INSTANCE instance, int capacity, string database)
{
this.instance = instance;
this.capacity = capacity;
this.database = database;
currentHi = GenerateNextHi();
currentLo = 0;
}
示例8: BackupOperation
public BackupOperation(DocumentDatabase database, string src, string to)
{
instance = database.TransactionalStorage.Instance;
this.database = database;
this.to = to;
this.src = src;
}
示例9: Setup
public void Setup()
{
this.directory = SetupHelper.CreateRandomDirectory();
this.database = Path.Combine(this.directory, "database.edb");
this.table = "table";
this.instance = SetupHelper.CreateNewInstance(this.directory);
Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.Recovery, 0, "off");
Api.JetInit(ref this.instance);
Api.JetBeginSession(this.instance, out this.sesid, String.Empty, String.Empty);
Api.JetCreateDatabase(this.sesid, this.database, String.Empty, out this.dbid, CreateDatabaseGrbit.None);
Api.JetBeginTransaction(this.sesid);
Api.JetCreateTable(this.sesid, this.dbid, this.table, 0, 100, out this.tableid);
JET_COLUMNID ignored;
var columndef = new JET_COLUMNDEF { coltyp = JET_coltyp.Text, cp = JET_CP.Unicode };
Api.JetAddColumn(this.sesid, this.tableid, "C1", columndef, null, 0, out ignored);
Api.JetAddColumn(this.sesid, this.tableid, "C2", columndef, null, 0, out ignored);
Api.JetAddColumn(this.sesid, this.tableid, "C3", columndef, null, 0, out ignored);
Api.JetCreateIndex(this.sesid, this.tableid, "Primary", CreateIndexGrbit.IndexPrimary, "+C1\0\0", 5, 100);
Api.JetCommitTransaction(this.sesid, CommitTransactionGrbit.LazyFlush);
JET_INDEXCREATE[] indexcreates = new[]
{
new JET_INDEXCREATE { szIndexName = "Index2", cbKey = 5, szKey = "+C2\0\0" },
new JET_INDEXCREATE { szIndexName = "Index3", cbKey = 5, szKey = "+C3\0\0", cbVarSegMac = 100 },
};
Api.JetCreateIndex2(this.sesid, this.tableid, indexcreates, indexcreates.Length);
Api.JetCloseTable(this.sesid, this.tableid);
Api.JetOpenTable(this.sesid, this.dbid, this.table, null, 0, OpenTableGrbit.None, out this.tableid);
}
示例10: BackupOperation
public BackupOperation(RavenFileSystem filesystem, string backupSourceDirectory, string backupDestinationDirectory, bool incrementalBackup,
FileSystemDocument filesystemDocument)
: base(filesystem, backupSourceDirectory, backupDestinationDirectory, incrementalBackup, filesystemDocument)
{
instance = ((TransactionalStorage)filesystem.Storage).Instance;
backupConfigPath = Path.Combine(backupDestinationDirectory, "RavenDB.Backup");
}
示例11: Setup
public void Setup()
{
this.directory = SetupHelper.CreateRandomDirectory();
this.database = Path.Combine(this.directory, "database.edb");
this.table = "table";
this.instance = SetupHelper.CreateNewInstance(this.directory);
Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.Recovery, 0, "off");
Api.JetInit(ref this.instance);
Api.JetBeginSession(this.instance, out this.sesid, String.Empty, String.Empty);
Api.JetCreateDatabase(this.sesid, this.database, String.Empty, out this.dbid, CreateDatabaseGrbit.None);
Api.JetBeginTransaction(this.sesid);
Api.JetCreateTable(this.sesid, this.dbid, this.table, 0, 100, out this.tableid);
var columndef = new JET_COLUMNDEF()
{
cp = JET_CP.Unicode,
coltyp = JET_coltyp.LongText,
};
Api.JetAddColumn(this.sesid, this.tableid, "TestColumn", columndef, null, 0, out this.testColumnid);
Api.JetCloseTable(this.sesid, this.tableid);
Api.JetCommitTransaction(this.sesid, CommitTransactionGrbit.LazyFlush);
Api.JetOpenTable(this.sesid, this.dbid, this.table, null, 0, OpenTableGrbit.None, out this.tableid);
}
示例12: Setup
public void Setup()
{
this.directory = SetupHelper.CreateRandomDirectory();
this.instance = SetupHelper.CreateNewInstance(this.directory);
Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.MaxTemporaryTables, 0, null);
Api.JetInit(ref this.instance);
}
示例13: BackupOperation
public BackupOperation(DocumentDatabase database, string src, string to)
{
instance = ((TransactionalStorage)database.TransactionalStorage).Instance;
this.database = database;
this.to = to.ToFullPath();
this.src = src.ToFullPath();
}
示例14: Setup
public void Setup()
{
this.directory = SetupHelper.CreateRandomDirectory();
this.database = Path.Combine(this.directory, "database.edb");
this.table = "table";
this.instance = SetupHelper.CreateNewInstance(this.directory);
Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.MaxTemporaryTables, 0, null);
Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.Recovery, 0, "off");
Api.JetInit(ref this.instance);
Api.JetBeginSession(this.instance, out this.sesid, String.Empty, String.Empty);
Api.JetCreateDatabase(this.sesid, this.database, String.Empty, out this.dbid, CreateDatabaseGrbit.None);
Api.JetBeginTransaction(this.sesid);
Api.JetCreateTable(this.sesid, this.dbid, this.table, 0, 100, out this.tableid);
var columndef = new JET_COLUMNDEF()
{
coltyp = JET_coltyp.Long,
grbit = ColumndefGrbit.ColumnEscrowUpdate,
};
Api.JetAddColumn(this.sesid, this.tableid, "EscrowColumn", columndef, BitConverter.GetBytes(0), 4, out this.columnid);
Api.JetCloseTable(this.sesid, this.tableid);
Api.JetCommitTransaction(this.sesid, CommitTransactionGrbit.LazyFlush);
Api.JetOpenTable(this.sesid, this.dbid, this.table, null, 0, OpenTableGrbit.None, out this.tableid);
Api.JetBeginTransaction(this.sesid);
Api.JetPrepareUpdate(this.sesid, this.tableid, JET_prep.Insert);
Api.JetUpdate(this.sesid, this.tableid);
Api.JetCommitTransaction(this.sesid, CommitTransactionGrbit.LazyFlush);
Api.JetMove(this.sesid, this.tableid, JET_Move.First, MoveGrbit.None);
}
示例15: Setup
public void Setup()
{
this.directory = SetupHelper.CreateRandomDirectory();
this.instance = SetupHelper.CreateNewInstance(this.directory);
// turn off logging so initialization is faster
Api.JetSetSystemParameter(this.instance, JET_SESID.Nil, JET_param.Recovery, 0, "off");
Api.JetInit(ref this.instance);
Api.JetBeginSession(this.instance, out this.sesid, String.Empty, String.Empty);
var columns = new[] { new JET_COLUMNDEF { coltyp = JET_coltyp.Long, grbit = ColumndefGrbit.TTKey } };
var columnids = new JET_COLUMNID[columns.Length];
// BUG: use TempTableGrbit.Indexed once in-memory TT bugs are fixed
Api.JetOpenTempTable(this.sesid, columns, columns.Length, TempTableGrbit.ForceMaterialization, out this.tableid, columnids);
this.columnid = columnids[0];
for (int i = 10; i <= 30; i += 10)
{
Api.JetPrepareUpdate(this.sesid, this.tableid, JET_prep.Insert);
Api.JetSetColumn(this.sesid, this.tableid, this.columnid, BitConverter.GetBytes(i), 4, SetColumnGrbit.None, null);
int ignored;
Api.JetUpdate(this.sesid, this.tableid, null, 0, out ignored);
}
}