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


C# HistoryRepository.GetUpgradeOperations方法代码示例

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


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

示例1: GetUpgradeOperations_should_return_nothing_when_table_not_present

        public void GetUpgradeOperations_should_return_nothing_when_table_not_present()
        {
            ResetDatabase();

            var historyRepository
                = new HistoryRepository(ConnectionString, ProviderFactory, "MyKey", null);

            Assert.False(historyRepository.GetUpgradeOperations().Any());
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:9,代码来源:HistoryRepositoryTests.cs

示例2: GetUpgradeOperations_should_return_alter_migration_id_column_when_5_to_6

        public void GetUpgradeOperations_should_return_alter_migration_id_column_when_5_to_6()
        {
            ResetDatabase();

            var historyRepository
                = new HistoryRepository(Mock.Of<InternalContextForMock>(), ConnectionString, ProviderFactory, "MyKey", null, HistoryContext.DefaultFactory);

            var createTableOperation = GetCreateHistoryTableOperation();

            createTableOperation.Columns.Remove(createTableOperation.Columns.Single(c => c.Name == "ContextKey"));
            createTableOperation.PrimaryKey.Columns.RemoveAt(1);

            ExecuteOperations(createTableOperation);

            var alterColumnOperation = historyRepository.GetUpgradeOperations().OfType<AlterColumnOperation>().Single();

            Assert.Equal("MigrationId", alterColumnOperation.Column.Name);
            Assert.Equal(150, alterColumnOperation.Column.MaxLength);
        }
开发者ID:jesusico83,项目名称:Telerik,代码行数:19,代码来源:HistoryRepositoryTests.cs

示例3: GetUpgradeOperations_should_return_context_key_column_when_not_present

        public void GetUpgradeOperations_should_return_context_key_column_when_not_present()
        {
            ResetDatabase();

            var historyRepository
                = new HistoryRepository(ConnectionString, ProviderFactory, "MyKey", null);

            var createTableOperation = GetCreateHistoryTableOperation();

            createTableOperation.Columns.Remove(createTableOperation.Columns.Single(c => c.Name == "ContextKey"));
            createTableOperation.PrimaryKey.Columns.RemoveAt(1);
            ExecuteOperations(createTableOperation);

            var addColumnOperation = historyRepository.GetUpgradeOperations().OfType<AddColumnOperation>().Single();

            Assert.Equal("ContextKey", addColumnOperation.Column.Name);
            Assert.Equal("MyKey", addColumnOperation.Column.DefaultValue);
            Assert.Equal(512, addColumnOperation.Column.MaxLength);
            Assert.False(addColumnOperation.Column.IsNullable.Value);
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:20,代码来源:HistoryRepositoryTests.cs

示例4: GetUpgradeOperations_should_return_add_product_version_column_when_not_present

        public void GetUpgradeOperations_should_return_add_product_version_column_when_not_present()
        {
            ResetDatabase();

            var historyRepository
                = new HistoryRepository(ConnectionString, ProviderFactory, "MyKey", null);

            var createTableOperation = GetCreateHistoryTableOperation();

            createTableOperation.Columns.Remove(createTableOperation.Columns.Last());

            ExecuteOperations(createTableOperation);

            var addColumnOperation = (AddColumnOperation)historyRepository.GetUpgradeOperations().Last();

            Assert.Equal("ProductVersion", addColumnOperation.Column.Name);
            Assert.Equal("0.7.0.0", addColumnOperation.Column.DefaultValue);
            Assert.Equal(32, addColumnOperation.Column.MaxLength);
            Assert.False(addColumnOperation.Column.IsNullable.Value);
        }
开发者ID:christiandpena,项目名称:entityframework,代码行数:20,代码来源:HistoryRepositoryTests.cs

示例5: GetUpgradeOperations_should_return_nothing_when_table_not_present

        public void GetUpgradeOperations_should_return_nothing_when_table_not_present()
        {
            ResetDatabase();

            var historyRepository
                = new HistoryRepository(Mock.Of<InternalContextForMock>(), ConnectionString, ProviderFactory, "MyKey", null, HistoryContext.DefaultFactory);

            Assert.False(historyRepository.GetUpgradeOperations().Any());
        }
开发者ID:jesusico83,项目名称:Telerik,代码行数:9,代码来源:HistoryRepositoryTests.cs


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