Exemple #1
0
        internal Database(DatabaseSystem system, IDatabaseContext context)
        {
            System = system;
            Context = context;

            Name = Context.DatabaseName();

            DiscoverDataVersion();

            TableComposite = new TableSourceComposite(this);

            Context.RegisterInstance(this);
            Context.RegisterInstance<ITableSourceComposite>(TableComposite);

            Locker = new Locker(this);

            Sessions = new ActiveSessionList(this);

            // Create the single row table
            var t = new TemporaryTable(context, "SINGLE_ROW_TABLE", new ColumnInfo[0]);
            t.NewRow();
            SingleRowTable = t;

            TransactionFactory = new DatabaseTransactionFactory(this);
        }
Exemple #2
0
        public DatabaseContext(ISystemContext systemContext, IConfiguration configuration)
        {
            if (systemContext == null)
                throw new ArgumentNullException("systemContext");
            if (configuration == null)
                throw new ArgumentNullException("configuration");

            SystemContext = systemContext;
            SystemContext.ServiceProvider.AttachContext(this);

            Configuration = configuration;
            Locker = new Locker(this);

            Sessions = new ActiveSessionList(this);

            Init();
        }
Exemple #3
0
        public LockTests()
        {
            var mock = new Mock <ILockable>();

            mock.SetupGet(x => x.RefId)
            .Returns(223);

            lockable = mock.Object;

            var scope = new ServiceContainer();

            var contextMock = new Mock <IContext>();

            contextMock.SetupGet(x => x.Scope)
            .Returns(scope);
            contextMock.Setup(x => x.Dispose())
            .Callback(scope.Dispose);

            context = contextMock.Object;

            locker = new Locker(context);
        }
Exemple #4
0
 internal LockHandle(Locker locker)
 {
     this.locker = locker;
     locks       = new List <Lock>();
 }