コード例 #1
0
        internal DocumentStore(TableMode mode, Configuration configuration, bool initialize)
        {
            Configuration = configuration;
            Logger        = configuration.Logger;
            TableMode     = mode;

            switch (mode)
            {
            case TableMode.RealTables:
                Database = new SqlServerUsingRealTables(this, configuration.ConnectionString);
                break;

            case TableMode.GlobalTempTables:
                Database = new SqlServerUsingGlobalTempTables(this, configuration.ConnectionString + ";Initial Catalog=TempDb");
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }

            if (initialize)
            {
                Initialize();
            }
        }
コード例 #2
0
ファイル: FapTable.cs プロジェクト: egman77/FapCore3.0
        public override int GetHashCode()
        {
            int hashCode = 17; // we *know* we are using this in a dictionary, so pre-compute this

            hashCode = hashCode * 23 + Id.GetHashCode();
            hashCode = hashCode * 23 + (Fid == null ? 0 : Fid.GetHashCode());
            hashCode = hashCode * 23 + (EnableDate == null ? 0 : EnableDate.GetHashCode());
            hashCode = hashCode * 23 + (DisableDate == null ? 0 : DisableDate.GetHashCode());
            hashCode = hashCode * 23 + Dr.GetHashCode();
            hashCode = hashCode * 23 + Ts.GetHashCode();
            hashCode = hashCode * 23 + (CreateBy == null ? 0 : CreateBy.GetHashCode());
            hashCode = hashCode * 23 + (CreateDate == null ? 0 : CreateDate.GetHashCode());
            hashCode = hashCode * 23 + (CreateName == null ? 0 : CreateName.GetHashCode());
            hashCode = hashCode * 23 + (UpdateBy == null ? 0 : UpdateBy.GetHashCode());
            hashCode = hashCode * 23 + (UpdateDate == null ? 0 : UpdateDate.GetHashCode());
            hashCode = hashCode * 23 + (UpdateName == null ? 0 : UpdateName.GetHashCode());
            hashCode = hashCode * 23 + (TableName == null ? 0 : TableName.GetHashCode());
            hashCode = hashCode * 23 + (TableComment == null ? 0 : TableComment.GetHashCode());
            hashCode = hashCode * 23 + (TableMode == null ? 0 : TableMode.GetHashCode());
            hashCode = hashCode * 23 + (SubTable == null ? 0 : SubTable.GetHashCode());
            hashCode = hashCode * 23 + IsTree.GetHashCode();
            hashCode = hashCode * 23 + IsPagination.GetHashCode();
            hashCode = hashCode * 23 + IsSync.GetHashCode();

            return(hashCode);
        }
コード例 #3
0
        public void CanAddColumnWithDefaultValue(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());
            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(store.Database);

            new AddColumn("Entities1", new Column("SomeNullableInt", typeof(int))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherNullableInt", typeof(int))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeString", typeof(int))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeInt", typeof(int))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeDateTime", typeof(DateTime))).Execute(store.Database);

            new ChangeColumnType("Entities1", new Column("SomeNullableInt", typeof(int?), defaultValue: null)).Execute(store.Database);
            new ChangeColumnType("Entities1", new Column("SomeOtherNullableInt", typeof(int?), defaultValue: 42)).Execute(store.Database);
            new ChangeColumnType("Entities1", new Column("SomeString", typeof(string), defaultValue: "peter")).Execute(store.Database);
            new ChangeColumnType("Entities1", new Column("SomeInt", typeof(int), defaultValue: 666)).Execute(store.Database);
            new ChangeColumnType("Entities1", new Column("SomeDateTime", typeof(DateTime), defaultValue: new DateTime(1999, 12, 24))).Execute(store.Database);

            var schema = store.Database.QuerySchema();

            schema["Entities1"]["SomeNullableInt"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeOtherNullableInt"].DefaultValue.ShouldBe(42);
            schema["Entities1"]["SomeString"].DefaultValue.ShouldBe("peter");
            schema["Entities1"]["SomeInt"].DefaultValue.ShouldBe(666);
            schema["Entities1"]["SomeDateTime"].DefaultValue.ShouldBe(new DateTime(1999, 12, 24));
        }
コード例 #4
0
ファイル: RentCarsForm.cs プロジェクト: zm21/Rental-Service
 public RentCarsForm(List <RentalCar> rentalCars, User user, TableMode tableMode, Label balance)
 {
     InitializeComponent();
     RetCarsMode = tableMode;
     this.user   = user;
     cars        = rentalCars;
     LB_balance  = balance;
     if (RetCarsMode == TableMode.MyRentedCars)
     {
         List <RentalCar> myrentedCars = new List <RentalCar>();
         for (int i = 0; i < cars.Count; i++)
         {
             if (cars[i].RentedID == user.ID)
             {
                 myrentedCars.Add(cars[i]);
             }
         }
         cars = myrentedCars;
         if (cars.Count == 0)
         {
             MsgBox msgBox = new MsgBox("Your rented car list is empty", "You have not rented any car yet");
             msgBox.ShowDialog();
         }
         lb_numOfDayRent.Visible   = false;
         numeric_daysCount.Visible = false;
         bt_rent.Visible           = false;
     }
     foreach (var car in cars)
     {
         AddCarToDataGrid(car);
     }
 }
コード例 #5
0
        internal DocumentStore(Configuration configuration, TableMode mode, string connectionString, bool testing)
        {
            Configuration = configuration;
            Logger        = configuration.Logger;

            switch (mode)
            {
            case TableMode.UseRealTables:
                Database = new SqlServerUsingRealTables(this, connectionString);
                break;

            case TableMode.UseTempTables:
                Database = new SqlServerUsingTempTables(this, connectionString);
                break;

            case TableMode.UseTempDb:
                Database = new SqlServerUsingTempDb(this, connectionString);
                break;

            default:
                throw new ArgumentOutOfRangeException("mode", mode, null);
            }

            this.testing = testing;
        }
コード例 #6
0
        public Table Begin(TableMode mode, bool isView = false)
        {
            switch (mode)
            {
            case TableMode.Create:
                StringComponent createTable = new StringComponent(Constants.QueryComponents.CREATE_TABLE);
                StringComponent createView  = new StringComponent(Constants.QueryComponents.CREATE_VIEW);
                _components.Add(isView ? createView : createTable);
                break;

            case TableMode.Alter:
                if (isView)
                {
                    throw new NotSupportedException("Sqlite error: Cannot alter a view");
                }
                _components.Add(new StringComponent(Constants.QueryComponents.ALTER_TABLE));
                break;

            case TableMode.Drop:
                StringComponent dropTable = new StringComponent(Constants.QueryComponents.DROP_TABLE);
                StringComponent dropView  = new StringComponent(Constants.QueryComponents.DROP_VIEW);
                _components.Add(isView ? dropView : dropTable);
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode), mode, null);
            }
            return(this);
        }
コード例 #7
0
        public void CanAddColumnWithDefaultValue(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());
            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(store.Database);

            new AddColumn("Entities1", new Column("SomeNullableInt", typeof(int))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherNullableInt", typeof(int))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeString", typeof(int))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeInt", typeof(int))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeDateTime", typeof(DateTime))).Execute(store.Database);

            new ChangeColumnType("Entities1", new Column("SomeNullableInt", typeof(int?), defaultValue: null)).Execute(store.Database);
            new ChangeColumnType("Entities1", new Column("SomeOtherNullableInt", typeof(int?), defaultValue: 42)).Execute(store.Database);
            new ChangeColumnType("Entities1", new Column("SomeString", typeof(string), defaultValue: "peter")).Execute(store.Database);
            new ChangeColumnType("Entities1", new Column("SomeInt", typeof(int), defaultValue: 666)).Execute(store.Database);
            new ChangeColumnType("Entities1", new Column("SomeDateTime", typeof(DateTime), defaultValue: new DateTime(1999, 12, 24))).Execute(store.Database);

            var schema = store.Database.QuerySchema();

            schema["Entities1"]["SomeNullableInt"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeOtherNullableInt"].DefaultValue.ShouldBe(42);
            schema["Entities1"]["SomeString"].DefaultValue.ShouldBe("peter");
            schema["Entities1"]["SomeInt"].DefaultValue.ShouldBe(666);
            schema["Entities1"]["SomeDateTime"].DefaultValue.ShouldBe(new DateTime(1999, 12, 24));
        }
コード例 #8
0
ファイル: CreateTableTests.cs プロジェクト: dcga/HybridDb
        public void CreatesTable(TableMode mode)
        {
            Use(mode);

            new CreateTable(new Table("Entities", new Column("Col1", typeof(string)))).Execute(database);

            database.QuerySchema().ShouldContainKey("Entities");
        }
コード例 #9
0
ファイル: CreateTableTests.cs プロジェクト: dcga/HybridDb
        public void CreatesPrimaryKeyColumn(TableMode mode, Type type, int? length)
        {
            Use(mode);

            new CreateTable(new Table("Entities", new Column("Col1", type, length, isPrimaryKey: true))).Execute(database);

            database.QuerySchema()["Entities"]["Col1"].IsPrimaryKey.ShouldBe(true);
        }
コード例 #10
0
        public static DocumentStore ForTesting(TableMode mode, Action <Configuration> configure, bool initialize = true)
        {
            var configuration = new Configuration();

            configure(configuration);

            return(ForTesting(mode, configuration, initialize));
        }
コード例 #11
0
        public static IDocumentStore ForTesting(TableMode mode, string connectionString, Action <Configuration> configure = null)
        {
            configure = configure ?? (x => { });
            var configuration = new Configuration();

            configure(configuration);
            return(new DocumentStore(configuration, mode, connectionString ?? "data source=.;Integrated Security=True", true));
        }
コード例 #12
0
ファイル: AddColumnTests.cs プロジェクト: dcga/HybridDb
        public void CanSetColumnAsPrimaryKey(TableMode mode)
        {
            Use(mode);

            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(database);
            new AddColumn("Entities1", new Column("SomeInt", typeof(int), isPrimaryKey: true)).Execute(database);

            database.QuerySchema()["Entities1"]["SomeInt"].IsPrimaryKey.ShouldBe(true);
        }
コード例 #13
0
        public void ColumnsHasDefaultValue(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(store.Database);

            new AddColumn("Entities1", new Column("SomeNullableInt", typeof(int?), defaultValue: null)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherNullableInt", typeof(int?), defaultValue: 42)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeNullableDecimal", typeof(decimal?), defaultValue: null)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherNullableDecimal", typeof(decimal?), defaultValue: 42.42m)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeNullableGuid", typeof(Guid?), defaultValue: null)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherNullableGuid", typeof(Guid?), defaultValue: new Guid("BAB0E469-DE94-4FDB-9868-968CA569E9A9"))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeNullableDateTime", typeof(DateTime?), defaultValue: null)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherNullableDateTime", typeof(DateTime?), defaultValue: new DateTime(1999, 12, 24))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeNullableDateTimeOffset", typeof(DateTimeOffset?), defaultValue: null)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherNullableDateTimeOffset", typeof(DateTimeOffset?), defaultValue: new DateTimeOffset(new DateTime(1999, 12, 24)))).Execute(store.Database);

            new AddColumn("Entities1", new Column("SomeGuid", typeof(Guid), defaultValue: new Guid("BAB0E469-DE94-4FDB-9868-968CA569E9A9"))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeInt", typeof(int), defaultValue: 666)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeDecimal", typeof(decimal), defaultValue: 666.22m)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeDouble", typeof(double), defaultValue: 666.42)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeLong", typeof(long), defaultValue: 987654321987654312)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeString", typeof(string), defaultValue: "peter")).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherString", typeof(string), defaultValue: null)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeBool", typeof(bool), defaultValue: true)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherBool", typeof(bool))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeDateTime", typeof(DateTime), defaultValue: new DateTime(1999, 12, 24))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeDateTimeOffset", typeof(DateTimeOffset), defaultValue: new DateTimeOffset(new DateTime(1999, 12, 24)))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeEnum", typeof(SomeEnum), defaultValue: SomeEnum.SomeOtherValue)).Execute(store.Database);

            var schema = store.Database.QuerySchema();

            schema["Entities1"]["SomeNullableInt"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeOtherNullableInt"].DefaultValue.ShouldBe(42);
            schema["Entities1"]["SomeNullableDecimal"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeOtherNullableDecimal"].DefaultValue.ShouldBe(42.42);
            schema["Entities1"]["SomeNullableGuid"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeOtherNullableGuid"].DefaultValue.ShouldBe(new Guid("BAB0E469-DE94-4FDB-9868-968CA569E9A9"));
            schema["Entities1"]["SomeNullableDateTime"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeOtherNullableDateTime"].DefaultValue.ShouldBe(new DateTime(1999, 12, 24));
            schema["Entities1"]["SomeNullableDateTimeOffset"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeOtherNullableDateTimeOffset"].DefaultValue.ShouldBe(new DateTimeOffset(new DateTime(1999, 12, 24)));

            schema["Entities1"]["SomeGuid"].DefaultValue.ShouldBe(new Guid("BAB0E469-DE94-4FDB-9868-968CA569E9A9"));
            schema["Entities1"]["SomeInt"].DefaultValue.ShouldBe(666);
            schema["Entities1"]["SomeDecimal"].DefaultValue.ShouldBe(666.22);
            schema["Entities1"]["SomeDouble"].DefaultValue.ShouldBe(666.42);
            schema["Entities1"]["SomeLong"].DefaultValue.ShouldBe(987654321987654312);
            schema["Entities1"]["SomeString"].DefaultValue.ShouldBe("peter");
            schema["Entities1"]["SomeOtherString"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeBool"].DefaultValue.ShouldBe(true);
            schema["Entities1"]["SomeOtherBool"].DefaultValue.ShouldBe(false);
            schema["Entities1"]["SomeDateTime"].DefaultValue.ShouldBe(new DateTime(1999, 12, 24));
            schema["Entities1"]["SomeDateTimeOffset"].DefaultValue.ShouldBe(new DateTimeOffset(new DateTime(1999, 12, 24)));
            schema["Entities1"]["SomeEnum"].DefaultValue.ShouldBe("SomeOtherValue");
        }
コード例 #14
0
ファイル: Cache.cs プロジェクト: PatrickShaw/MySci---STS
 public static ElementPane[] panesSelected(TableMode modeT)
 {
     ElementPane[] elePanesT = new ElementPane[elementsSelected.Count()];
     for (int i = 0; i < elementsSelected.Count(); i++)
     {
         elePanesT[i] = new ElementPane(modeT,elementsSelected[i].AtomicNumber-1);
     }
     return elePanesT;
 }
コード例 #15
0
ファイル: CreateTableTests.cs プロジェクト: SimonCle/HybridDb
        public void CreatesPrimaryKeyColumn(TableMode mode, Type type, int?length)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            store.Execute(new CreateTable(new Table("Entities", new Column("Col1", type, length, isPrimaryKey: true))));

            //store.Database.QuerySchema()["Entities"]["Col1"].IsPrimaryKey.ShouldBe(true);
        }
コード例 #16
0
        public void CreatesPrimaryKeyColumn(TableMode mode, Type type, int? length)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            new CreateTable(new Table("Entities", new Column("Col1", type, length, isPrimaryKey: true))).Execute(store.Database);

            store.Database.QuerySchema()["Entities"]["Col1"].IsPrimaryKey.ShouldBe(true);
        }
コード例 #17
0
        public void CreatesTable(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            new CreateTable(new Table("Entities", new Column("Col1", typeof(string)))).Execute(store.Database);

            store.Database.QuerySchema().ShouldContainKey("Entities");
        }
コード例 #18
0
ファイル: AddColumnTests.cs プロジェクト: dcga/HybridDb
        public void AddsColumn(TableMode mode)
        {
            Use(mode);
            new CreateTable(new Table("Entities", new Column("Col1", typeof(int)))).Execute(database);

            new AddColumn("Entities", new Column("Col2", typeof(int))).Execute(database);

            database.QuerySchema()["Entities"]["Col2"].ShouldNotBe(null);
        }
コード例 #19
0
ファイル: CreateTableTests.cs プロジェクト: SimonCle/HybridDb
        public void CreatesTable(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            store.Execute(new CreateTable(new Table("Entities", new Column("Col1", typeof(string)))));

            store.Database.QuerySchema().ShouldContainKey("Entities");
        }
コード例 #20
0
        public void ColumnsHasDefaultValue(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(store.Database);

            new AddColumn("Entities1", new Column("SomeNullableInt", typeof(int?), defaultValue: null)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherNullableInt", typeof(int?), defaultValue: 42)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeNullableDecimal", typeof(decimal?), defaultValue: null)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherNullableDecimal", typeof(decimal?), defaultValue: 42.42m)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeNullableGuid", typeof(Guid?), defaultValue: null)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherNullableGuid", typeof(Guid?), defaultValue: new Guid("BAB0E469-DE94-4FDB-9868-968CA569E9A9"))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeNullableDateTime", typeof(DateTime?), defaultValue: null)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherNullableDateTime", typeof(DateTime?), defaultValue: new DateTime(1999, 12, 24))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeNullableDateTimeOffset", typeof(DateTimeOffset?), defaultValue: null)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherNullableDateTimeOffset", typeof(DateTimeOffset?), defaultValue: new DateTimeOffset(new DateTime(1999, 12, 24)))).Execute(store.Database);

            new AddColumn("Entities1", new Column("SomeGuid", typeof(Guid), defaultValue: new Guid("BAB0E469-DE94-4FDB-9868-968CA569E9A9"))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeInt", typeof(int), defaultValue: 666)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeDecimal", typeof(decimal), defaultValue: 666.22m)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeDouble", typeof(double), defaultValue: 666.42)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeLong", typeof(long), defaultValue: 987654321987654312)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeString", typeof(string), defaultValue: "peter")).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherString", typeof(string), defaultValue: null)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeBool", typeof(bool), defaultValue: true)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeOtherBool", typeof(bool))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeDateTime", typeof(DateTime),  defaultValue: new DateTime(1999, 12, 24))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeDateTimeOffset", typeof(DateTimeOffset), defaultValue: new DateTimeOffset(new DateTime(1999, 12, 24)))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeEnum", typeof(SomeEnum), defaultValue: SomeEnum.SomeOtherValue)).Execute(store.Database);

            var schema = store.Database.QuerySchema();

            schema["Entities1"]["SomeNullableInt"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeOtherNullableInt"].DefaultValue.ShouldBe(42);
            schema["Entities1"]["SomeNullableDecimal"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeOtherNullableDecimal"].DefaultValue.ShouldBe(42.42);
            schema["Entities1"]["SomeNullableGuid"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeOtherNullableGuid"].DefaultValue.ShouldBe(new Guid("BAB0E469-DE94-4FDB-9868-968CA569E9A9"));
            schema["Entities1"]["SomeNullableDateTime"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeOtherNullableDateTime"].DefaultValue.ShouldBe(new DateTime(1999, 12, 24));
            schema["Entities1"]["SomeNullableDateTimeOffset"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeOtherNullableDateTimeOffset"].DefaultValue.ShouldBe(new DateTimeOffset(new DateTime(1999, 12, 24)));

            schema["Entities1"]["SomeGuid"].DefaultValue.ShouldBe(new Guid("BAB0E469-DE94-4FDB-9868-968CA569E9A9"));
            schema["Entities1"]["SomeInt"].DefaultValue.ShouldBe(666);
            schema["Entities1"]["SomeDecimal"].DefaultValue.ShouldBe(666.22);
            schema["Entities1"]["SomeDouble"].DefaultValue.ShouldBe(666.42);
            schema["Entities1"]["SomeLong"].DefaultValue.ShouldBe(987654321987654312);
            schema["Entities1"]["SomeString"].DefaultValue.ShouldBe("peter");
            schema["Entities1"]["SomeOtherString"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeBool"].DefaultValue.ShouldBe(true);
            schema["Entities1"]["SomeOtherBool"].DefaultValue.ShouldBe(false);
            schema["Entities1"]["SomeDateTime"].DefaultValue.ShouldBe(new DateTime(1999, 12, 24));
            schema["Entities1"]["SomeDateTimeOffset"].DefaultValue.ShouldBe(new DateTimeOffset(new DateTime(1999, 12, 24)));
            schema["Entities1"]["SomeEnum"].DefaultValue.ShouldBe("SomeOtherValue");
        }
コード例 #21
0
        public void ChangeType(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());
            new CreateTable(new Table("Entities", new Column("Col1", typeof(Guid)))).Execute(store.Database);

            new ChangeColumnType("Entities", new Column("Col1", typeof(string))).Execute(store.Database);

            store.Database.QuerySchema()["Entities"]["Col1"].Type.ShouldBe(typeof(string));
        }
コード例 #22
0
ファイル: AddColumnTests.cs プロジェクト: chessydk/HybridDb
        public void AddsColumn(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());
            new CreateTable(new Table("Entities", new Column("Col1", typeof(int)))).Execute(store.Database);

            new AddColumn("Entities", new Column("Col2", typeof(int))).Execute(store.Database);

            store.Database.QuerySchema()["Entities"]["Col2"].ShouldNotBe(null);
        }
コード例 #23
0
        public void CanSetColumnAsPrimaryKey(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            store.Execute(new CreateTable(new Table("Entities1", new Column("test", typeof(int)))));
            store.Execute(new AddColumn("Entities1", new Column("SomeInt", typeof(int), isPrimaryKey: true)));

            //store.Database.QuerySchema()["Entities1"]["SomeInt"].IsPrimaryKey.ShouldBe(true);
        }
コード例 #24
0
ファイル: SqlMigrationTests.cs プロジェクト: dcga/HybridDb
        public void AddsColumn(TableMode mode)
        {
            Use(mode);
            new CreateTable(new Table("Entities", new Column("Col1", typeof(int)))).Execute(database);
            new AddColumn("Entities", new Column("Col2", typeof(int))).Execute(database);

            new SqlMigrationCommand("add some index", (sql, db) => sql
                .Append($"alter table {db.FormatTableNameAndEscape("Entities")} add {db.Escape("Col3")} int"))
                .Execute(database);
        }
コード例 #25
0
        public void AddsColumn(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());
            new CreateTable(new Table("Entities", new Column("Col1", typeof(int)))).Execute(store.Database);

            new AddColumn("Entities", new Column("Col2", typeof(int))).Execute(store.Database);

            store.Database.QuerySchema()["Entities"]["Col2"].ShouldNotBe(null);
        }
コード例 #26
0
 public Table(string[][] contents, int lengthSum, ConsoleColor?textColor = null, ConsoleColor?headingColor = null, TableMode tableMode = TableMode.NoHeader)
 {
     this.TableMode    = tableMode;
     this.headingColor = headingColor;
     this.textColor    = textColor;
     Height            = contents.Length;
     Width             = lengthSum;
     lastRendered      = new Canvas(Height, Width);
     Update(contents);
 }
コード例 #27
0
        public void ChangeTypeWithPrimaryKey(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());
            new CreateTable(new Table("Entities", new Column("Col1", typeof(Guid)))).Execute(store.Database);

            new ChangeColumnType("Entities", new Column("Col1", typeof(string), isPrimaryKey: true, length: 255)).Execute(store.Database);

            store.Database.QuerySchema()["Entities"]["Col1"].IsPrimaryKey.ShouldBe(true);
        }
コード例 #28
0
ファイル: RenameTableTests.cs プロジェクト: dcga/HybridDb
        public void RenamesTable(TableMode mode)
        {
            Use(mode);
            new CreateTable(new Table("Entities", new Column("col1", typeof(int)))).Execute(database);

            new RenameTable("Entities", "OtherEntities").Execute(database);

            database.QuerySchema().ShouldNotContainKey("Entities");
            database.QuerySchema().ShouldContainKey("OtherEntities");
        }
コード例 #29
0
        public void ChangeType(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());
            new CreateTable(new Table("Entities", new Column("Col1", typeof(Guid)))).Execute(store.Database);

            new ChangeColumnType("Entities", new Column("Col1", typeof(string))).Execute(store.Database);

            store.Database.QuerySchema()["Entities"]["Col1"].Type.ShouldBe(typeof(string));
        }
コード例 #30
0
ファイル: AddColumnTests.cs プロジェクト: dcga/HybridDb
        public void SetsColumnAsNullableAndUsesUnderlyingTypeWhenNullable(TableMode mode)
        {
            Use(mode);
            new CreateTable(new Table("Entities", new Column("Col1", typeof(int)))).Execute(database);

            new AddColumn("Entities", new Column("Col2", typeof(int?))).Execute(database);

            database.QuerySchema()["Entities"]["Col2"].Type.ShouldBe(typeof(int));
            database.QuerySchema()["Entities"]["Col2"].Nullable.ShouldBe(true);
        }
コード例 #31
0
        public void ColumnIsOfCorrectType(TableMode mode, Type type, bool nullable)
        {
            Use(TableMode.RealTables);
            store.Execute(new CreateTable(new Table("Entities", new Column("Col1", typeof(int)))));

            store.Execute(new AddColumn("Entities", new Column("Col2", type)));

            //store.Database.QuerySchema()["Entities"]["Col2"].Type.ShouldBe(type);
            //store.Database.QuerySchema()["Entities"]["Col2"].Nullable.ShouldBe(nullable);
        }
コード例 #32
0
ファイル: AddColumnTests.cs プロジェクト: dcga/HybridDb
        public void ColumnIsOfCorrectType(TableMode mode, Type type, bool nullable)
        {
            Use(TableMode.UseRealTables);
            new CreateTable(new Table("Entities", new Column("Col1", typeof(int)))).Execute(database);

            new AddColumn("Entities", new Column("Col2", type)).Execute(database);

            database.QuerySchema()["Entities"]["Col2"].Type.ShouldBe(type);
            database.QuerySchema()["Entities"]["Col2"].Nullable.ShouldBe(nullable);
        }
コード例 #33
0
        public void ChangeTypeWithPrimaryKey(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());
            new CreateTable(new Table("Entities", new Column("Col1", typeof(Guid)))).Execute(store.Database);

            new ChangeColumnType("Entities", new Column("Col1", typeof(string), isPrimaryKey: true, length: 255)).Execute(store.Database);

            store.Database.QuerySchema()["Entities"]["Col1"].IsPrimaryKey.ShouldBe(true);
        }
コード例 #34
0
        public void CanSetColumnAsPrimaryKey(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            new CreateTable(new Table("Entities1", new Column("col1", typeof(int)))).Execute(store.Database);
            new ChangeColumnType("Entities1", new Column("col1", typeof(int), isPrimaryKey: true)).Execute(store.Database);

            store.Database.QuerySchema()["Entities1"]["col1"].IsPrimaryKey.ShouldBe(true);
        }
コード例 #35
0
        public void AddsColumn(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());
            store.Execute(new CreateTable(new Table("Entities", new Column("Col1", typeof(int)))));
            store.Execute(new AddColumn("Entities", new Column("Col2", typeof(int))));

            store.Execute(new SqlCommand("add some index", (sql, db) => sql
                                         .Append($"alter table {db.FormatTableNameAndEscape("Entities")} add {db.Escape("Col3")} int")));
        }
コード例 #36
0
ファイル: RenameTableTests.cs プロジェクト: chessydk/HybridDb
        public void RenamesTable(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());
            new CreateTable(new Table("Entities", new Column("col1", typeof(int)))).Execute(store.Database);

            new RenameTable("Entities", "OtherEntities").Execute(store.Database);

            store.Database.QuerySchema().ShouldNotContainKey("Entities");
            store.Database.QuerySchema().ShouldContainKey("OtherEntities");
        }
コード例 #37
0
        public void SetsColumnAsNullableAndUsesUnderlyingTypeWhenNullable(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());
            store.Execute(new CreateTable(new Table("Entities", new Column("Col1", typeof(int)))));

            store.Execute(new AddColumn("Entities", new Column("Col2", typeof(int?))));

            //store.Database.QuerySchema()["Entities"]["Col2"].Type.ShouldBe(typeof(int));
            //store.Database.QuerySchema()["Entities"]["Col2"].Nullable.ShouldBe(true);
        }
コード例 #38
0
        public void RemovesTempTableColumn(TableMode mode)
        {
            Use(mode);

            var table = new Table("Entities", new Column("FirstColumn", typeof(int)));
            new CreateTable(table).Execute(store.Database);
            new AddColumn("Entities", new Column("SomeColumn", typeof(int))).Execute(store.Database);

            new RemoveColumn(table, "SomeColumn").Execute(store.Database);

            store.Database.QuerySchema()["Entities"]["SomeColumn"].ShouldBe(null);
        }
コード例 #39
0
        public void RemovesTempTableColumn(TableMode mode)
        {
            Use(mode);

            var table = new Table("Entities", new Column("FirstColumn", typeof(int)));

            new CreateTable(table).Execute(store.Database);
            new AddColumn("Entities", new Column("SomeColumn", typeof(int))).Execute(store.Database);

            new RemoveColumn(table, "SomeColumn").Execute(store.Database);

            store.Database.QuerySchema()["Entities"]["SomeColumn"].ShouldBe(null);
        }
コード例 #40
0
        public void ReturnsAllTables(TableMode mode)
        {
            NoInitialize();
            Use(mode);

            store.Execute(new CreateTable(new Table("Entities1", new Column("test", typeof(int)))));
            store.Execute(new CreateTable(new Table("Entities2", new Column("test", typeof(int)))));

            var schema = store.Database.QuerySchema();

            schema.Keys.ShouldContain("Entities1");
            schema.Keys.ShouldContain("Entities2");
        }
コード例 #41
0
        public void ReturnsAllTables(TableMode mode)
        {
            Use(mode, prefix: Guid.NewGuid().ToString());

            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(database);
            new CreateTable(new Table("Entities2", new Column("test", typeof(int)))).Execute(database);

            var schema = database.QuerySchema();

            schema["Entities1"].ShouldNotBe(null);
            schema["Entities1"].Name.ShouldBe("Entities1");
            schema["Entities2"].ShouldNotBe(null);
            schema["Entities2"].Name.ShouldBe("Entities2");
        }
コード例 #42
0
        public void ColumnsHasPrimaryKeyInfo(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeInt", typeof(int), isPrimaryKey: true)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeString", typeof(string), isPrimaryKey: false)).Execute(store.Database);

            var schema = store.Database.QuerySchema();

            schema["Entities1"]["SomeInt"].IsPrimaryKey.ShouldBe(true);
            schema["Entities1"]["SomeString"].IsPrimaryKey.ShouldBe(false);
        }
コード例 #43
0
ファイル: RenameColumnTests.cs プロジェクト: dcga/HybridDb
        public void RenamesColumn(TableMode mode)
        {
            Use(mode);

            var table = new Table("Entities", new Column("Col1", typeof(int)));

            new CreateTable(table).Execute(database);
            new AddColumn("Entities", new Column("SomeColumn", typeof(int))).Execute(database);

            new RenameColumn(table, "SomeColumn", "SomeNewColumn").Execute(database);

            database.QuerySchema()["Entities"]["SomeColumn"].ShouldBe(null);
            database.QuerySchema()["Entities"]["SomeNewColumn"].ShouldNotBe(null);
        }
コード例 #44
0
        public void ColumnsHasNullableInfo(TableMode mode)
        {
            Use(mode);

            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(database);
            new AddColumn("Entities1", new Column("SomeNullableInt", typeof(int?))).Execute(database);
            new AddColumn("Entities1", new Column("SomeString", typeof(string))).Execute(database);
            new AddColumn("Entities1", new Column("SomeInt", typeof(int))).Execute(database);

            var schema = database.QuerySchema();

            schema["Entities1"]["SomeNullableInt"].Nullable.ShouldBe(true);
            schema["Entities1"]["SomeInt"].Nullable.ShouldBe(false);
            schema["Entities1"]["SomeString"].Nullable.ShouldBe(true);
        }
コード例 #45
0
        public void ReturnsAllTables(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(store.Database);
            new CreateTable(new Table("Entities2", new Column("test", typeof(int)))).Execute(store.Database);

            var schema = store.Database.QuerySchema();

            schema["Entities1"].ShouldNotBe(null);
            schema["Entities1"].Name.ShouldBe("Entities1");
            schema["Entities2"].ShouldNotBe(null);
            schema["Entities2"].Name.ShouldBe("Entities2");
        }
コード例 #46
0
        public void CanHandleLegacyBooleanDefaultValues(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(store.Database);

            store.Database.RawExecute(string.Format("alter table {0} add [SomeFalseBool] Bit NOT NULL DEFAULT '0'", store.Database.FormatTableNameAndEscape("Entities1")));
            store.Database.RawExecute(string.Format("alter table {0} add [SomeTrueBool] Bit NOT NULL DEFAULT '1'", store.Database.FormatTableNameAndEscape("Entities1")));

            var schema = store.Database.QuerySchema();

            schema["Entities1"]["SomeFalseBool"].DefaultValue.ShouldBe(false);
            schema["Entities1"]["SomeTrueBool"].DefaultValue.ShouldBe(true);
        }
コード例 #47
0
        public void RenamesColumn(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            var table = new Table("Entities", new Column("Col1", typeof(int)));

            new CreateTable(table).Execute(store.Database);
            new AddColumn("Entities", new Column("SomeColumn", typeof(int))).Execute(store.Database);

            new RenameColumn(table, "SomeColumn", "SomeNewColumn").Execute(store.Database);

            store.Database.QuerySchema()["Entities"]["SomeColumn"].ShouldBe(null);
            store.Database.QuerySchema()["Entities"]["SomeNewColumn"].ShouldNotBe(null);
        }
コード例 #48
0
        public void CanHandleLegacyBooleanDefaultValues(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(store.Database);

            store.Database.RawExecute(string.Format("alter table {0} add [SomeFalseBool] Bit NOT NULL DEFAULT '0'", store.Database.FormatTableNameAndEscape("Entities1")));
            store.Database.RawExecute(string.Format("alter table {0} add [SomeTrueBool] Bit NOT NULL DEFAULT '1'", store.Database.FormatTableNameAndEscape("Entities1")));

            var schema = store.Database.QuerySchema();

            schema["Entities1"]["SomeFalseBool"].DefaultValue.ShouldBe(false);
            schema["Entities1"]["SomeTrueBool"].DefaultValue.ShouldBe(true);
        }
コード例 #49
0
        public void RenamesColumn(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            var table = new Table("Entities", new Column("Col1", typeof(int)));

            new CreateTable(table).Execute(store.Database);
            new AddColumn("Entities", new Column("SomeColumn", typeof(int))).Execute(store.Database);

            new RenameColumn(table, "SomeColumn", "SomeNewColumn").Execute(store.Database);

            store.Database.QuerySchema()["Entities"]["SomeColumn"].ShouldBe(null);
            store.Database.QuerySchema()["Entities"]["SomeNewColumn"].ShouldNotBe(null);
        }
コード例 #50
0
        public void ColumnsHasTypeInfo(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeInt", typeof(int))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeBool", typeof(bool))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeString", typeof(string))).Execute(store.Database);

            var schema = store.Database.QuerySchema();

            schema["Entities1"]["SomeInt"].Type.ShouldBe(typeof(int));
            schema["Entities1"]["SomeBool"].Type.ShouldBe(typeof(bool));
            schema["Entities1"]["SomeString"].Type.ShouldBe(typeof(string));
        }
コード例 #51
0
ファイル: HybridDbTests.cs プロジェクト: SimonCle/HybridDb
        protected void Use(TableMode mode, string prefix = null)
        {
            switch (mode)
            {
            case TableMode.RealTables:
                UseRealTables();
                break;

            case TableMode.GlobalTempTables:
                UseGlobalTempTables();
                break;

            default:
                throw new ArgumentOutOfRangeException(nameof(mode));
            }
        }
コード例 #52
0
        public void DoesNotRunProvidedSchemaMigrationsOnTempTables(TableMode mode)
        {
            Use(mode);

            CreateMetadataTable();

            UseMigrations(new InlineMigration(1,
                new CreateTable(new Table("Testing", new Column("Id", typeof(Guid), isPrimaryKey: true))),
                new AddColumn("Testing", new Column("Noget", typeof(int)))));

            var runner = new SchemaMigrationRunner(store, new FakeSchemaDiffer());

            runner.Run();

            var tables = database.QuerySchema();
            tables.ShouldNotContainKey("Testing");
        }
コード例 #53
0
        public void ReturnsAllColumns(TableMode mode)
        {
            Use(mode, prefix: Guid.NewGuid().ToString());

            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(database);
            new AddColumn("Entities1", new Column("SomeInt", typeof(int))).Execute(database);
            new AddColumn("Entities1", new Column("SomeBool", typeof(bool))).Execute(database);

            new CreateTable(new Table("Entities2", new Column("test", typeof(int)))).Execute(database);
            new AddColumn("Entities2", new Column("SomeString", typeof(string))).Execute(database);

            var schema = database.QuerySchema();

            schema["Entities1"]["SomeInt"].ShouldNotBe(null);
            schema["Entities1"]["SomeBool"].ShouldNotBe(null);
            schema["Entities2"]["SomeString"].ShouldNotBe(null);
        }
コード例 #54
0
        public void ReturnsAllColumns(TableMode mode)
        {
            NoInitialize();
            Use(mode);

            store.Execute(new CreateTable(new Table("Entities1", new Column("test", typeof(int)))));
            store.Execute(new AddColumn("Entities1", new Column("SomeInt", typeof(int))));
            store.Execute(new AddColumn("Entities1", new Column("SomeBool", typeof(bool))));

            store.Execute(new CreateTable(new Table("Entities2", new Column("test", typeof(int)))));
            store.Execute(new AddColumn("Entities2", new Column("SomeString", typeof(string))));

            var schema = store.Database.QuerySchema();

            schema["Entities1"].ShouldContain("SomeInt");
            schema["Entities1"].ShouldContain("SomeBool");
            schema["Entities2"].ShouldContain("SomeString");
        }
コード例 #55
0
ファイル: CreateTableTests.cs プロジェクト: dcga/HybridDb
        public void CanCreateColumnWithDefaultValue(TableMode mode)
        {
            Use(mode);

            new CreateTable(new Table("Entities1",
                new Column("SomeNullableInt", typeof(int?), defaultValue: null),
                new Column("SomeOtherNullableInt", typeof(int?), defaultValue: 42),
                new Column("SomeString", typeof(string),  defaultValue: "peter"),
                new Column("SomeInt", typeof(int),  defaultValue: 666),
                new Column("SomeDateTime", typeof(DateTime),  defaultValue: new DateTime(1999, 12, 24)))).Execute(database);

            var schema = database.QuerySchema();

            schema["Entities1"]["SomeNullableInt"].DefaultValue.ShouldBe(null);
            schema["Entities1"]["SomeOtherNullableInt"].DefaultValue.ShouldBe(42);
            schema["Entities1"]["SomeString"].DefaultValue.ShouldBe("peter");
            schema["Entities1"]["SomeInt"].DefaultValue.ShouldBe(666);
            schema["Entities1"]["SomeDateTime"].DefaultValue.ShouldBe(new DateTime(1999, 12, 24));
        }
コード例 #56
0
        public void DoesNotRunProvidedSchemaMigrationsOnTempTables(TableMode mode)
        {
            Use(mode);

            UseTableNamePrefix(Guid.NewGuid().ToString());
            CreateMetadataTable();

            UseMigrations(new InlineMigration(1,
                                              new CreateTable(new Table("Testing", new Column("Id", typeof(Guid), isPrimaryKey: true))),
                                              new AddColumn("Testing", new Column("Noget", typeof(int)))));

            var runner = new SchemaMigrationRunner(store, new FakeSchemaDiffer());

            runner.Run();

            var tables = store.Database.QuerySchema();

            tables.ShouldNotContainKey("Testing");
        }
コード例 #57
0
        public void ColumnsHasPrimaryKeyInfo(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeInt", typeof(int), isPrimaryKey: true)).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeString", typeof(string),  isPrimaryKey: false)).Execute(store.Database);

            var schema = store.Database.QuerySchema();

            schema["Entities1"]["SomeInt"].IsPrimaryKey.ShouldBe(true);
            schema["Entities1"]["SomeString"].IsPrimaryKey.ShouldBe(false);
        }
コード例 #58
0
        public void ColumnsHasTypeInfo(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());

            new CreateTable(new Table("Entities1", new Column("test", typeof(int)))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeInt", typeof(int))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeBool", typeof(bool))).Execute(store.Database);
            new AddColumn("Entities1", new Column("SomeString", typeof(string))).Execute(store.Database);

            var schema = store.Database.QuerySchema();

            schema["Entities1"]["SomeInt"].Type.ShouldBe(typeof(int));
            schema["Entities1"]["SomeBool"].Type.ShouldBe(typeof(bool));
            schema["Entities1"]["SomeString"].Type.ShouldBe(typeof(string));
        }
コード例 #59
0
        public ElementPane(TableMode modeT,int indexT)
        {

            InitializeComponent(); 
            mode = modeT;
            index = indexT;
            AtomicMass = decimal.Parse(Math.Round(PeriodicTable.elements[index].atomicMass.TotalAmount, 2).ToString()).ToString("G29");
            AtomicNumber = PeriodicTable.elements[index].AtomicNumber.ToString();
            Symbol = PeriodicTable.elements[index].symbol;
            switch (mode)
            {
                case TableMode.selection:
                case TableMode.information:
                case TableMode.display:
                    eleName = PeriodicTable.elements[index].name;
                    break;
                case TableMode.standard:
                    Percentage = 1;
                    eleName = Percentage.ToString();
                    lblName.FontSize = 11;
                    lblName.FontWeight = FontWeights.Bold;
                    break;
                case TableMode.empirical:
                    eleName = Percentage.ToString();
                    lblName.FontSize = 11;
                    lblName.FontWeight = FontWeights.Bold;
                    eleName += "%";
                    break;
            }
            BrushDefault = new SolidColorBrush(Element.GetElementColour(index));
        }
コード例 #60
0
        public void SetsColumnAsNullableAndUsesUnderlyingTypeWhenNullable(TableMode mode)
        {
            Use(mode);
            UseTableNamePrefix(Guid.NewGuid().ToString());
            new CreateTable(new Table("Entities", new Column("Col1", typeof(int)))).Execute(store.Database);

            new ChangeColumnType("Entities", new Column("Col1", typeof(int?))).Execute(store.Database);

            store.Database.QuerySchema()["Entities"]["Col1"].Type.ShouldBe(typeof(int));
            store.Database.QuerySchema()["Entities"]["Col1"].Nullable.ShouldBe(true);
        }