Example #1
0
 public RemoteEsentStorage(RemoteEsentStorageState state)
 {
     instance = state.Instance;
     database = state.Database;
     tableColumnsCache = new TableColumnsCache();
     tableColumnsCache.InitColumDictionaries(instance, database);
 }
Example #2
0
 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;
     }
 }
Example #3
0
        public DocumentStorageActions(
            JET_INSTANCE instance,
            string database,
            TableColumnsCache tableColumnsCache,
            OrderedPartCollection <AbstractDocumentCodec> documentCodecs,
            IUuidGenerator uuidGenerator,
            IDocumentCacher cacher,
            EsentTransactionContext transactionContext,
            TransactionalStorage transactionalStorage)
        {
            this.tableColumnsCache    = tableColumnsCache;
            this.documentCodecs       = documentCodecs;
            this.uuidGenerator        = uuidGenerator;
            this.cacher               = cacher;
            this.transactionalStorage = transactionalStorage;
            this.transactionContext   = transactionContext;

            try
            {
                if (transactionContext == null)
                {
                    session     = new Session(instance);
                    transaction = new Transaction(session);
                    sessionAndTransactionDisposer = () =>
                    {
                        if (transaction != null)
                        {
                            transaction.Dispose();
                        }
                        if (session != null)
                        {
                            session.Dispose();
                        }
                    };
                }
                else
                {
                    session     = transactionContext.Session;
                    transaction = transactionContext.Transaction;
                    var disposable = transactionContext.EnterSessionContext();
                    sessionAndTransactionDisposer = disposable.Dispose;
                }
                Api.JetOpenDatabase(session, database, null, out dbid, OpenDatabaseGrbit.None);
            }
            catch (Exception ex)
            {
                logger.WarnException("Error when trying to open a new DocumentStorageActions", ex);
                try
                {
                    Dispose();
                }
                catch (Exception e)
                {
                    logger.WarnException("Error on dispose when the ctor threw an exception, resources may have leaked", e);
                }
                throw;
            }
        }
Example #4
0
		public DocumentStorageActions(JET_INSTANCE instance, string database, TableColumnsCache tableColumnsCache)
		{
			this.tableColumnsCache = tableColumnsCache;
			try
			{
				session = new Session(instance);
				transaction = new Transaction(session);
				Api.JetOpenDatabase(session, database, null, out dbid, OpenDatabaseGrbit.None);
			}
			catch (Exception)
			{
				Dispose();
				throw;
			}
		}
Example #5
0
 public DocumentStorageActions(JET_INSTANCE instance, string database, TableColumnsCache tableColumnsCache, IEnumerable <AbstractDocumentCodec> documentCodecs)
 {
     this.tableColumnsCache = tableColumnsCache;
     this.documentCodecs    = documentCodecs;
     try
     {
         session     = new Session(instance);
         transaction = new Transaction(session);
         Api.JetOpenDatabase(session, database, null, out dbid, OpenDatabaseGrbit.None);
     }
     catch (Exception)
     {
         Dispose();
         throw;
     }
 }