예제 #1
0
        public void Initialize()
        {
            var connection = Effort.DbConnectionFactory.CreateTransient();

            this.model   = CompiledModels.GetModel <RelationEntity, EmptyEntity>();
            this.context = new FeatureDbContext(connection, this.model);
        }
예제 #2
0
 public void Initialize()
 {
     this.context =
         new FeatureDbContext(
             DbConnectionFactory.CreateTransient(),
             CompiledModels.GetModel <MathEntity>());
 }
예제 #3
0
        public void DbManager_ClearTables()
        {
            var connection = (EffortConnection)DbConnectionFactory.CreateTransient();

            var model   = CompiledModels.GetModel <RelationEntity, EmptyEntity>();
            var context = new FeatureDbContext(connection, model);

            context.Database.Initialize(true);

            context.RelationEntities.Add(
                new RelationEntity
            {
                RequiredRelation = new EmptyEntity()
            });

            context.SaveChanges();

            // Create new context
            context = new FeatureDbContext(connection, model);

            // The records should be in
            context.EmptyEntities.Count().Should().Be(1);
            context.RelationEntities.Count().Should().Be(1);

            // Use DbManager to delete all data from the database
            connection.Open();
            connection.DbManager.ClearTables();

            // Tables should be empty
            context.EmptyEntities.Count().Should().Be(0);
            context.RelationEntities.Count().Should().Be(0);
        }
예제 #4
0
 public void Initialize()
 {
     this.context =
         new FeatureDbContext(
             Effort.DbConnectionFactory.CreateTransient(),
             CompiledModels.GetModel <
                 StringFieldEntity>());
 }
예제 #5
0
        public void Initialize()
        {
            DbConnection connection =
                Effort.DbConnectionFactory.CreateTransient();

            this.context =
                new FeatureDbContext(
                    connection,
                    CompiledModels.GetModel <GuidKeyEntity>());
        }
예제 #6
0
        public void Initialize()
        {
            this.connection = (EffortConnection)DbConnectionFactory.CreateTransient();

            this.context =
                new FeatureDbContext(
                    connection,
                    CompiledModels.GetModel <RequiredFieldEntity>());

            this.context.Configuration.ValidateOnSaveEnabled = false;
        }
예제 #7
0
        public void Initialize()
        {
            DbConnection connection = DbConnectionFactory.CreateTransient();

            InitializeData(connection);

            this.context =
                new FeatureDbContext(
                    connection,
                    CompiledModels.GetModel <NumberFieldEntity>());
        }
예제 #8
0
        public void StringFieldFixture_LargeStringFieldCreation()
        {
            DbConnection connection =
                Effort.DbConnectionFactory.CreateTransient();

            FeatureDbContext context =
                new FeatureDbContext(
                    connection,
                    CompiledModels.GetModel <LargeStringFieldEntity>());

            context.Database.Initialize(true);
        }
예제 #9
0
        public void LargePrimaryKeyCreation()
        {
            var connection =
                DbConnectionFactory.CreateTransient();

            var context =
                new FeatureDbContext(
                    connection,
                    CompiledModels.GetModel <LargePrimaryKeyEntity>());

            context.Database.CreateIfNotExists();
        }
예제 #10
0
        public void SpatialFixture_SpatialFeatureCreation()
        {
            DbConnection connection =
                Effort.DbConnectionFactory.CreateTransient();

            FeatureDbContext context =
                new FeatureDbContext(
                    connection,
                    CompiledModels.GetModel <SpatialEntity>());

            context.Database.Initialize(true);
        }
        public void Initialize()
        {
            if (connection == null)
            {
                connection   = Effort.DbConnectionFactory.CreateTransient();
                this.context =
                    new FeatureDbContext(
                        connection,
                        CompiledModels.GetModel <
                            StringFieldEntity>());

                this.context.Database.CreateIfNotExists();
            }
        }
예제 #12
0
        public void Initialize()
        {
            this.context =
                new FeatureDbContext(
                    Effort.DbConnectionFactory.CreateTransient(),
                    CompiledModels.GetModel <TimeFieldEntity>());

            this.Entities.Add(
                new TimeFieldEntity
            {
                Time = stored
            });

            this.context.SaveChanges();
        }
예제 #13
0
        private static void InitializeData(DbConnection connection)
        {
            var context =
                new FeatureDbContext(
                    connection,
                    CompiledModels.GetModel <NumberFieldEntity>());

            context.NumberFieldEntities.Add(
                new NumberFieldEntity {
                Value8  = 0x0f,
                Value16 = 0x0f,
                Value32 = 0x0f,
                Value64 = 0x0f
            });

            context.SaveChanges();
            connection.Close();
        }