Exemplo n.º 1
0
        /// <summary>
        /// The drop and create write database.
        /// </summary>
        public bool DropAndCreateWriteDatabase()
        {
            try
            {
                System.Data.Entity.Database.SetInitializer(new WriteInitializer());
                var writeContext = new WriteContext();
                writeContext.Database.Initialize(true);

                return true;
            }
            catch (Exception ex)
            {
                this.logger.Error(ex);
                Debug.WriteLine(ex.Message);

                return false;
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// The create write event repository.
        /// </summary>
        public static Repository<WriteEvent> CreateWriteEventRepository()
        {
            var writeContext = new WriteContext();

            return new Repository<WriteEvent>(writeContext);
        }
Exemplo n.º 3
0
        /// <summary>
        /// Initiates database before tests.
        /// </summary>
        private void InitDatabaseBeforeTests()
        {
            FixEfProviderServicesProblem();

            RemoveExistingDatabase("Write", "WriteContext");
            RemoveExistingDatabase("Read", "ReadContext");

            System.Data.Entity.Database.SetInitializer(new WriteInitializer());
            this.WriteContext = new WriteContext();
            this.WriteContext.Database.Initialize(true);

            System.Data.Entity.Database.SetInitializer(new ReadInitializer());
            this.ReadContext = new ReadContext();
            this.ReadContext.Database.Initialize(true);
        }