コード例 #1
0
ファイル: TableSchemaTests.cs プロジェクト: alexmaris/Gribble
        public void should_create_table()
        {
            var tableName = "Temp" + Guid.NewGuid().ToString("N");

            Gribble.TableSchema.Create(Database.Connection, profiler: Profiler).CreateTable(tableName,
                                                                                            new Column("Id", typeof(Guid), key: Column.KeyType.PrimaryKey, isAutoGenerated: true),
                                                                                            new Column("Name", typeof(string), isNullable: true, length: 500),
                                                                                            new Column("Active", typeof(bool), isNullable: false, defaultValue: true),
                                                                                            new Column("Score", typeof(decimal), isNullable: false, precision: 5, scale: 1),
                                                                                            new Column("ScoreA", isNullable: false, computation: "Score * 55"),
                                                                                            new Column("ScoreB", isNullable: false, computation: "Score * 55", computationPersisted: true),
                                                                                            new Column("Created", typeof(DateTime), isNullable: false, isAutoGenerated: true));

            Database.ExecuteScalar <int>("SELECT COUNT(*) FROM sys.tables WHERE name='{0}'", tableName).ShouldEqual(1);
        }