当前位置: 首页>>代码示例>>C#>>正文


C# Schema.AddColumn方法代码示例

本文整理汇总了C#中Schema.AddColumn方法的典型用法代码示例。如果您正苦于以下问题:C# Schema.AddColumn方法的具体用法?C# Schema.AddColumn怎么用?C# Schema.AddColumn使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在Schema的用法示例。


在下文中一共展示了Schema.AddColumn方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。

示例1: SimpleQueryTests

        static SimpleQueryTests()
        {
            repository = new Repository("SimpleQueryTests");
            schema = new Schema(repository, "news");
            schema.AddColumn(new Column()
            {
                Name = "Title",
                DataType = DataType.String,
                Length = 256
            });
            schema.AddColumn(new Column()
            {
                Name = "Comments",
                DataType = DataType.Int
            });

            folder = new TextFolder(repository, "news");
            folder.SchemaName = schema.Name;

            ProviderFactory providerFactory = new ProviderFactory();
            Providers.DefaultProviderFactory = providerFactory;
            providerFactory.GetProvider<IRepositoryProvider>().Add(repository);
            providerFactory.GetProvider<ISchemaProvider>().Add(schema);
            providerFactory.GetProvider<ITextFolderProvider>().Add(folder);

            InitializeData();
        }
开发者ID:Godoy,项目名称:CMS,代码行数:27,代码来源:SimpleQueryTests.cs

示例2: QueryTests

        public QueryTests()
        {
            EmptyUserKeyGenerator.DefaultGenerator = new EmptyUserKeyGenerator();
            Providers.DefaultProviderFactory = new MongoDB.ProviderFactory();

            repository = new Repository(Kooboo.UniqueIdGenerator.GetInstance().GetBase32UniqueId(10).ToString());
            Providers.DefaultProviderFactory.GetProvider<IRepositoryProvider>().Add(repository);
            categorySchema = new Schema(repository, "category") { IsDummy = false };
            categorySchema.AddColumn(new Column() { Name = "Title" });
            categoryFolder = new TextFolder(repository, "Category") { SchemaName = categorySchema.Name, IsDummy = false };
            Providers.DefaultProviderFactory.GetProvider<ITextFolderProvider>().Add(categoryFolder);

            newsSchema = new Schema(repository, "News") { IsDummy = false };
            newsSchema.AddColumn(new Column() { Name = "title", DataType = Data.DataType.String });
            newsSchema.AddColumn(new Column() { Name = "Body", DataType = Data.DataType.String });
            newsSchema.AddColumn(new Column() { Name = "Comments", DataType = Data.DataType.Int });
            Providers.DefaultProviderFactory.GetProvider<ISchemaProvider>().Add(newsSchema);

            newsFolder = new TextFolder(repository, "News") { SchemaName = newsSchema.Name, Categories = new List<CategoryFolder>() { new CategoryFolder() { FolderName = categoryFolder.FullName, SingleChoice = false } }, OrderSetting = new OrderSetting() { FieldName = "Sequence", Direction = OrderDirection.Descending } };
            Providers.DefaultProviderFactory.GetProvider<ITextFolderProvider>().Add(newsFolder);

            commentSchema = new Schema(repository, "Comment") { IsDummy = false };
            commentSchema.AddColumn(new Column() { Name = "Title" });
            Providers.DefaultProviderFactory.GetProvider<ISchemaProvider>().Add(commentSchema);

            category1 = new TextContent(repository.Name, categorySchema.Name, categoryFolder.FullName);
            category1["title"] = "category1";
            provider.Add(category1);

            category2 = new TextContent(repository.Name, categorySchema.Name, categoryFolder.FullName);
            category2["title"] = "category2";
            provider.Add(category2);

            newsContent = new TextContent(repository.Name, newsSchema.Name, newsFolder.FullName);
            newsContent["title"] = "news1";
            newsContent["body"] = "body";
            newsContent["comments"] = 1;
            provider.Add(newsContent);

            news2 = new TextContent(repository.Name, newsSchema.Name, newsFolder.FullName);
            news2["title"] = "news2";
            news2["body"] = "body";
            news2["comments"] = 0;
            provider.Add(news2);

            news3 = new TextContent(repository.Name, newsSchema.Name, newsFolder.FullName);
            news3["title"] = "news2";
            news3["body"] = "body";
            news3["comments"] = 5;
            provider.Add(news3);

            provider.AddCategories(newsContent, new Category() { ContentUUID = newsContent.UUID, CategoryUUID = category1.UUID, CategoryFolder = category1.FolderName });
            provider.AddCategories(newsContent, new Category() { ContentUUID = newsContent.UUID, CategoryUUID = category2.UUID, CategoryFolder = category2.FolderName });

            commenContent = new TextContent(repository.Name, commentSchema.Name, "");
            commenContent.ParentFolder = newsContent.FolderName;
            commenContent.ParentUUID = newsContent.UUID;
            commenContent["title"] = "comment1";
            provider.Add(commenContent);
        }
开发者ID:Epitomy,项目名称:CMS,代码行数:60,代码来源:QueryTests.cs

示例3: TextContentBinderTests

 public TextContentBinderTests()
 {
     schema = new Schema() { IsDummy = false };
     schema.AddColumn(new Column()
     {
         Name = "Title",
         DataType = DataType.String,
         ControlType = "TextBox",
         Validations = new ColumnValidation[] { new RequiredValidation() { ErrorMessage = "The field is requried" } }
     });
     schema.AddColumn(new Column()
         {
             Name = "Body",
             DataType = DataType.String,
             ControlType = "TextBox"
         });
     schema.AddColumn(new Column()
     {
         Name = "Comments",
         DataType = DataType.Int,
         ControlType = "TextBox"
     });
     schema.AddColumn(new Column()
     {
         Name = "PostDate",
         DataType = DataType.DateTime,
         ControlType = "TextBox"
     });
 }
开发者ID:Godoy,项目名称:CMS,代码行数:29,代码来源:TextContentBinderTests.cs

示例4: ParentQueryTests

        static ParentQueryTests()
        {
            repository = new Repository("ParentQueryTests");

            commentSchema = new Schema(repository, "comments");
            commentSchema.AddColumn(new Column() { Name = "title", DataType = Kooboo.Data.DataType.String, Length = 256 });


            newsSchema = new Schema(repository, "news") { ChildSchemas = new[] { commentSchema.Name } };
            newsSchema.AddColumn(new Column()
            {
                Name = "Title",
                DataType = Kooboo.Data.DataType.String,
                Length = 256
            });
            newsSchema.AddColumn(new Column()
            {
                Name = "Comments",
                DataType = Kooboo.Data.DataType.Int
            });

            newsFolder = new TextFolder(repository, "news") { SchemaName = newsSchema.Name };

            ProviderFactory providerFactory = new ProviderFactory();
            Providers.DefaultProviderFactory = providerFactory;
            providerFactory.GetProvider<IRepositoryProvider>().Add(repository);
            providerFactory.GetProvider<ISchemaProvider>().Add(commentSchema);
            providerFactory.GetProvider<ISchemaProvider>().Add(newsSchema);
            providerFactory.GetProvider<ITextFolderProvider>().Add(newsFolder);
            InitializeData();
        }
开发者ID:Godoy,项目名称:CMS,代码行数:31,代码来源:ParentQueryTests.cs

示例5: TestAdd

        public void TestAdd()
        {
            Schema schema = new Schema(repository, "news") { IsDummy = false };

            schema.AddColumn(new Column()
            {
                Name = "Title",
                DataType = DataType.String,
                Length = 100
            });

            //add
            SchemaManager.Add(schema);

            Schema newSchema = new Schema(repository, "news") { IsDummy = false };

            newSchema.AddColumn(new Column()
            {
                Name = "Title",
                DataType = DataType.String,
                Length = 100
            });

            newSchema.AddColumn(new Column()
            {
                Name = "Body",
                DataType = DataType.String,
                Length = 256
            });
            newSchema.AddColumn(new Column()
            {
                Name = "Comments",
                DataType = DataType.Int
            });
            //add column
            SchemaManager.Update(newSchema, schema);

            //remove column
            Schema lastSchema = new Schema(repository, "news") { IsDummy = false };

            lastSchema.AddColumn(new Column()
            {
                Name = "Title",
                DataType = DataType.String,
                Length = 100
            });

            lastSchema.AddColumn(new Column()
            {
                Name = "Body",
                DataType = DataType.String,
                Length = 256
            });

            //add column
            SchemaManager.Update(lastSchema, newSchema);

            SchemaManager.Delete(lastSchema);

        }
开发者ID:Godoy,项目名称:CMS,代码行数:60,代码来源:SchemaManagerTests.cs

示例6: CategoriesQueryTests

        static CategoriesQueryTests()
        {
            repository = new Repository("CategoriesQueryTests");

            categorySchema = new Schema(repository, "category");
            categorySchema.AddColumn(new Column() { Name = "title", DataType = DataType.String, Length = 256 });

            categoryFolder = new TextFolder(repository, "category") { SchemaName = categorySchema.Name };

            newsSchema = new Schema(repository, "news");
            newsSchema.AddColumn(new Column()
            {
                Name = "Title",
                DataType = DataType.String,
                Length = 256
            });
            newsSchema.AddColumn(new Column()
            {
                Name = "Comments",
                DataType = DataType.Int
            });

            newsFolder = new TextFolder(repository, "news") { SchemaName = newsSchema.Name, CategoryFolders = new[] { categoryFolder.Name } };

            ProviderFactory providerFactory = new ProviderFactory();
            Providers.DefaultProviderFactory = providerFactory;
            providerFactory.GetProvider<IRepositoryProvider>().Add(repository);
            providerFactory.GetProvider<ISchemaProvider>().Add(categorySchema);
            providerFactory.GetProvider<ISchemaProvider>().Add(newsSchema);
            providerFactory.GetProvider<ITextFolderProvider>().Add(newsFolder);
            providerFactory.GetProvider<ITextFolderProvider>().Add(categoryFolder);
            InitializeData();
        }
开发者ID:Epitomy,项目名称:CMS,代码行数:33,代码来源:CategoriesQueryTests.cs

示例7: InsertUpdateDeleteTests

        public InsertUpdateDeleteTests()
        {
            repository = new Repository("InsertUpdateDeleteTests");
            newsSchema = new Schema(repository, "News");
            newsSchema.AddColumn(new Column() { Name = "title", DataType = Data.DataType.String });
            newsSchema.AddColumn(new Column() { Name = "Body", DataType = Data.DataType.String });
            textFolder = new TextFolder(repository, "News") { SchemaName = newsSchema.Name };

            EmptyUserKeyGenerator.DefaultGenerator = new EmptyUserKeyGenerator();
        }
开发者ID:Epitomy,项目名称:CMS,代码行数:10,代码来源:InsertUpdateDeleteTests.cs

示例8: QueryTests

        public QueryTests()
        {
            EmptyUserKeyGenerator.DefaultGenerator = new EmptyUserKeyGenerator();
            Providers.DefaultProviderFactory = new RavenDB.ProviderFactory();
            Database.Current = new EmbeddedDatabase();

            repository = new Repository(Guid.NewGuid().ToString());
            Providers.DefaultProviderFactory.GetProvider<IRepositoryProvider>().Add(repository);

            categorySchema = new Schema(repository, "category") { IsDummy = false };
            categorySchema.AddColumn(new Column() { Name = "Title" });
            Providers.DefaultProviderFactory.GetProvider<ISchemaProvider>().Add(categorySchema);
            categoryFolder = new TextFolder(repository, "Category") { SchemaName = categorySchema.Name, IsDummy = false };
            Providers.DefaultProviderFactory.GetProvider<ITextFolderProvider>().Add(categoryFolder);

            newsSchema = new Schema(repository, "News") { IsDummy = false };
            newsSchema.AddColumn(new Column() { Name = "title", DataType = Data.DataType.String });
            newsSchema.AddColumn(new Column() { Name = "Body", DataType = Data.DataType.String });
            newsSchema.AddColumn(new Column() { Name = "Comments", DataType = Data.DataType.Int });
            Providers.DefaultProviderFactory.GetProvider<ISchemaProvider>().Add(newsSchema);
            newsFolder = new TextFolder(repository, "News") { SchemaName = newsSchema.Name, CategoryFolders = new[] { categoryFolder.FullName }, IsDummy = false };
            Providers.DefaultProviderFactory.GetProvider<ITextFolderProvider>().Add(newsFolder);

            commentSchema = new Schema(repository, "Comment") { IsDummy = false };
            commentSchema.AddColumn(new Column() { Name = "Title" });
            Providers.DefaultProviderFactory.GetProvider<ISchemaProvider>().Add(commentSchema);

            category1 = new TextContent(repository.Name, categorySchema.Name, categoryFolder.FullName);
            category1["title"] = "category1";
            provider.Add(category1);

            category2 = new TextContent(repository.Name, categorySchema.Name, categoryFolder.FullName);
            category2["title"] = "category2";
            provider.Add(category2);

            newsContent = new TextContent(repository.Name, newsSchema.Name, newsFolder.FullName);
            newsContent["title"] = "news1";
            newsContent["body"] = "body";
            newsContent["comments"] = 10;
            provider.Add(newsContent);

            provider.AddCategories(newsContent, new Category() { ContentUUID = newsContent.UUID, CategoryUUID = category1.UUID, CategoryFolder = category1.FolderName });
            provider.AddCategories(newsContent, new Category() { ContentUUID = newsContent.UUID, CategoryUUID = category2.UUID, CategoryFolder = category2.FolderName });

            commenContent = new TextContent(repository.Name, commentSchema.Name, "");
            commenContent.ParentUUID = newsContent.UUID;
            commenContent["title"] = "comment1";
            provider.Add(commenContent);
        }
开发者ID:bbqchickenrobot,项目名称:CMS-RavenDBProvider,代码行数:49,代码来源:QueryTests.cs

示例9: InsertUpdateDeleteTests

        public InsertUpdateDeleteTests()
        {
            EmptyUserKeyGenerator.DefaultGenerator = new EmptyUserKeyGenerator();
            Providers.DefaultProviderFactory = new RavenDB.ProviderFactory();

            repository = new Repository("InsertUpdateDeleteTests");
            Providers.DefaultProviderFactory.GetProvider<IRepositoryProvider>().Add(repository);

            newsSchema = new Schema(repository, "News");
            newsSchema.AddColumn(new Column() { Name = "title", DataType = Data.DataType.String });
            newsSchema.AddColumn(new Column() { Name = "Body", DataType = Data.DataType.String });
            Providers.DefaultProviderFactory.GetProvider<ISchemaProvider>().Add(newsSchema);

            textFolder = new TextFolder(repository, "News") { SchemaName = newsSchema.Name };
            Providers.DefaultProviderFactory.GetProvider<ITextFolderProvider>().Add(textFolder);
        }
开发者ID:bbqchickenrobot,项目名称:CMS-RavenDBProvider,代码行数:16,代码来源:InsertUpdateDeleteTests.cs

示例10: TestColumnDefinitions_GetEnumerable_Explicit

 public void TestColumnDefinitions_GetEnumerable_Explicit()
 {
     Schema schema = new Schema();
     ColumnDefinition id = new Int32Column("id");
     ColumnDefinition name = new StringColumn("name");
     ColumnDefinition created = new DateTimeColumn("created");
     schema.AddColumn(id).AddColumn(name).AddColumn(created);
     IEnumerable collection = schema.ColumnDefinitions;
     IEnumerator enumerator = collection.GetEnumerator();
 }
开发者ID:Blackman21,项目名称:FlatFileReaders,代码行数:10,代码来源:SchemaTester.cs

示例11: TextContentProviderTest

        public TextContentProviderTest()
        {
            repository = new Repository("TextContentProviderTest");

            newsSchema = new Schema(repository, "News");
            newsSchema.AddColumn(new Column() { Name = "title", DataType = Common.DataType.String });
            newsSchema.AddColumn(new Column() { Name = "Body", DataType = Common.DataType.String });
            schemaProvider.Initialize(newsSchema);

            textFolder = new TextFolder(repository, "News") { SchemaName = newsSchema.Name };

            news1 = new TextContent(repository.Name, newsSchema.Name, textFolder.FullName);
            news1["Title"] = "title1";
            news1["body"] = "body1";

            category1 = new TextContent(repository.Name, "category", "category");
            category1["Title"] = "category1";

            categories = new Category[] { new Category() { ContentUUID = news1.UUID, CategoryFolder = category1.FolderName, CategoryUUID = category1.UUID } };
        }
开发者ID:Godoy,项目名称:CMS,代码行数:20,代码来源:TextContentProviderTest.cs

示例12: TestColumnDefinitions_FindByIndex

 public void TestColumnDefinitions_FindByIndex()
 {
     Schema schema = new Schema();
     ColumnDefinition id = new Int32Column("id");
     ColumnDefinition name = new StringColumn("name");
     ColumnDefinition created = new DateTimeColumn("created");
     schema.AddColumn(id).AddColumn(name).AddColumn(created);
     ColumnCollection collection = schema.ColumnDefinitions;
     Assert.AreSame(id, collection[0], "The first column definition was wrong.");
     Assert.AreSame(name, collection[1], "The second column definition was wrong.");
     Assert.AreSame(created, collection[2], "The third column definition was wrong.");
 }
开发者ID:Blackman21,项目名称:FlatFileReaders,代码行数:12,代码来源:SchemaTester.cs

示例13: TestParseValues_WrongNumber_Throws

 public void TestParseValues_WrongNumber_Throws()
 {
     Schema schema = new Schema();
     schema.AddColumn(new StringColumn("name"));
     schema.ParseValues(new string[] { "bob", "smith" });
 }
开发者ID:Blackman21,项目名称:FlatFileReaders,代码行数:6,代码来源:SchemaTester.cs

示例14: TestGetSchema_SchemaProvided_ParsesValues

 public void TestGetSchema_SchemaProvided_ParsesValues()
 {
     const string text = @"123,Bob,1/19/2013";
     Schema schema = new Schema();
     schema.AddColumn(new Int32Column("id"))
           .AddColumn(new StringColumn("name"))
           .AddColumn(new DateTimeColumn("created"));
     SeparatedValueParser parser = new SeparatedValueParser(new MemoryStream(Encoding.Default.GetBytes(text)), schema);
     Assert.IsTrue(parser.Read(), "The first record was skipped.");
     object[] actual = parser.GetValues();
     object[] expected = new object[] { 123, "Bob", new DateTime(2013, 1, 19) };
     CollectionAssert.AreEqual(expected, actual, "The values were not parsed as expected.");
 }
开发者ID:Blackman21,项目名称:FlatFileReaders,代码行数:13,代码来源:SeparatedValueParserTester.cs

示例15: TestGetSchema_SchemaProvided_WrongNumberOfColumns_Throws

 public void TestGetSchema_SchemaProvided_WrongNumberOfColumns_Throws()
 {
     const string text = @"123,Bob";
     Schema schema = new Schema();
     schema.AddColumn(new Int32Column("id"))
           .AddColumn(new StringColumn("name"))
           .AddColumn(new DateTimeColumn("created"));
     SeparatedValueParser parser = new SeparatedValueParser(new MemoryStream(Encoding.Default.GetBytes(text)), schema);
     parser.Read();
 }
开发者ID:Blackman21,项目名称:FlatFileReaders,代码行数:10,代码来源:SeparatedValueParserTester.cs


注:本文中的Schema.AddColumn方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。