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


C# Expressions.DeleteForeignKeyExpression类代码示例

本文整理汇总了C#中FluentMigrator.Expressions.DeleteForeignKeyExpression的典型用法代码示例。如果您正苦于以下问题:C# DeleteForeignKeyExpression类的具体用法?C# DeleteForeignKeyExpression怎么用?C# DeleteForeignKeyExpression使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


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

示例1: CollectValidationErrorsShouldReturnNoErrorsIfForeignTableNameAndForeignKeyNameAreSet

        public void CollectValidationErrorsShouldReturnNoErrorsIfForeignTableNameAndForeignKeyNameAreSet()
        {
            var expression = new DeleteForeignKeyExpression { ForeignKey = new ForeignKeyDefinition { ForeignTable = "ForeignTable", Name = "FK"} };
            var errors = ValidationHelper.CollectErrors(expression);

            Assert.That(errors.Count, Is.EqualTo(0));
        }
开发者ID:BarsBarsovich,项目名称:fluentmigrator,代码行数:7,代码来源:DeleteForeignKeyExpressionTests.cs

示例2: Delete_Foreign_Key_Should_Throw_Exception_If_Table_Name_Is_Null

        public void Delete_Foreign_Key_Should_Throw_Exception_If_Table_Name_Is_Null()
        {
            // Setup empty FK
            var deleteFKExpression = new DeleteForeignKeyExpression();
            var fkDef = new ForeignKeyDefinition();
            deleteFKExpression.ForeignKey = fkDef;

            // Setup empty mock object
            var mockGenerator = new MockGenerator(null, null, null);

            Assert.Throws<ArgumentNullException>(() => mockGenerator.Generate(deleteFKExpression));
        }
开发者ID:ibebbs,项目名称:fluentmigrator,代码行数:12,代码来源:GenericGeneratorTests.cs

示例3: CollectValidationErrorsShouldReturnErrorsIfForeignColumnsAreSetButNotPrimaryTable

        public void CollectValidationErrorsShouldReturnErrorsIfForeignColumnsAreSetButNotPrimaryTable()
        {
            var expression = new DeleteForeignKeyExpression
            {
                ForeignKey = new ForeignKeyDefinition
                {
                    ForeignColumns = new Collection<string> { "User_id" },
                    ForeignTable = "UserRoles",
                    Name = "FK"
                }
            };
            var errors = ValidationHelper.CollectErrors(expression);

            errors.ShouldContain(ErrorMessages.PrimaryTableNameCannotBeNullOrEmpty);
        }
开发者ID:BarsBarsovich,项目名称:fluentmigrator,代码行数:15,代码来源:DeleteForeignKeyExpressionTests.cs

示例4: ReverseReturnsDeleteForeignKeyExpressionAfterApplyingConventions

 public void ReverseReturnsDeleteForeignKeyExpressionAfterApplyingConventions()
 {
     var expression = new DeleteForeignKeyExpression
     {
         ForeignKey = new ForeignKeyDefinition
         {
             ForeignColumns = new Collection<string> { "User_id" },
             ForeignTable = "UserRoles",
             PrimaryColumns = new Collection<string> { "Id" },
             PrimaryTable = "User",
         }
     };
     expression.ApplyConventions(new MigrationConventions());
     var reverse = expression.Reverse();
     reverse.ShouldBeOfType<CreateForeignKeyExpression>();
 }
开发者ID:BarsBarsovich,项目名称:fluentmigrator,代码行数:16,代码来源:DeleteForeignKeyExpressionTests.cs

示例5: Generate

 public override string Generate(DeleteForeignKeyExpression expression)
 {
     truncator.Truncate(expression);
     return base.Generate(expression);
 }
开发者ID:akema-fr,项目名称:fluentmigrator,代码行数:5,代码来源:FirebirdGenerator.cs

示例6: Generate

        public override string Generate(DeleteForeignKeyExpression expression)
        {
            if (expression.ForeignKey.ForeignTable == null)
                throw new ArgumentNullException("Table name not specified, ensure you have appended the OnTable extension. Format should be Delete.ForeignKey(KeyName).OnTable(TableName)");

            return string.Format(DeleteConstraint, Quoter.QuoteTableName(expression.ForeignKey.ForeignTable), Quoter.QuoteColumnName(expression.ForeignKey.Name));
        }
开发者ID:robertmircea,项目名称:fluentmigrator,代码行数:7,代码来源:GenericGenerator.cs

示例7: ForeignKey

 public IDeleteForeignKeyFromTableSyntax ForeignKey()
 {
     var expression = new DeleteForeignKeyExpression();
     _context.Expressions.Add(expression);
     return new DeleteForeignKeyExpressionBuilder(expression);
 }
开发者ID:elfrostie,项目名称:fluentmigrator,代码行数:6,代码来源:DeleteExpressionRoot.cs

示例8: Generate

 public override string Generate(DeleteForeignKeyExpression expression)
 {
     return string.Format(DeleteConstraint, Quoter.QuoteTableName(expression.ForeignKey.ForeignTable), Quoter.QuoteColumnName(expression.ForeignKey.Name));
 }
开发者ID:timscott,项目名称:fluentmigrator,代码行数:4,代码来源:GenericGenerator.cs

示例9: Generate

 public override string Generate(DeleteForeignKeyExpression expression)
 {
     return string.Format("ALTER TABLE {0}.{1} DROP CONSTRAINT {2}", Quoter.QuoteSchemaName(expression.ForeignKey.ForeignTableSchema), Quoter.QuoteTableName(expression.ForeignKey.ForeignTable), Quoter.Quote(expression.ForeignKey.Name));
 }
开发者ID:VSoftTechnologies,项目名称:fluentmigrator,代码行数:4,代码来源:PostgresGenerator.cs

示例10: GetDeleteForeignKeyExpression

 public static DeleteForeignKeyExpression GetDeleteForeignKeyExpression()
 {
     var expression = new DeleteForeignKeyExpression();
     expression.ForeignKey.Name = "FK_Test";
     expression.ForeignKey.ForeignTable = TestTableName1;
     return expression;
 }
开发者ID:hazzik,项目名称:fluentmigrator,代码行数:7,代码来源:GeneratorTestHelper.cs

示例11: Generate

 public override string Generate(DeleteForeignKeyExpression expression)
 {
     return string.Format("ALTER TABLE {0}.{1} DROP CONSTRAINT {2}", FormatSchema(expression.ForeignKey.ForeignTableSchema), FormatIdentifier(expression.ForeignKey.ForeignTable), FormatIdentifier(expression.ForeignKey.Name));
 }
开发者ID:timscott,项目名称:fluentmigrator,代码行数:4,代码来源:PostgresGenerator.cs

示例12: Generate

 public override string Generate(DeleteForeignKeyExpression expression)
 {
     throw new NotImplementedException();
 }
开发者ID:rebootd,项目名称:fluentmigrator,代码行数:4,代码来源:GenericGeneratorImplementor.cs

示例13: CollectValidationErrorsShouldReturnErrorsIfForeignColumnsAreSetButNotPrimaryColumns

        public void CollectValidationErrorsShouldReturnErrorsIfForeignColumnsAreSetButNotPrimaryColumns()
        {
            var expression = new DeleteForeignKeyExpression
            {
                ForeignKey = new ForeignKeyDefinition
                {
                    ForeignColumns = new Collection<string> { "User_id" },
                    ForeignTable = "UserRoles",
                    PrimaryTable = "User",
                    Name = "FK"
                }
            };
            var errors = ValidationHelper.CollectErrors(expression);

            errors.ShouldContain(ErrorMessages.ForeignKeyMustHaveOneOrMorePrimaryColumns);
        }
开发者ID:BarsBarsovich,项目名称:fluentmigrator,代码行数:16,代码来源:DeleteForeignKeyExpressionTests.cs

示例14: CollectValidationErrorsShouldReturnErrorIfForeignTableNameIsNull

 public void CollectValidationErrorsShouldReturnErrorIfForeignTableNameIsNull()
 {
     var expression = new DeleteForeignKeyExpression { ForeignKey = new ForeignKeyDefinition { ForeignTable = null } };
     var errors = ValidationHelper.CollectErrors(expression);
     errors.ShouldContain(ErrorMessages.ForeignTableNameCannotBeNullOrEmpty);
 }
开发者ID:BarsBarsovich,项目名称:fluentmigrator,代码行数:6,代码来源:DeleteForeignKeyExpressionTests.cs

示例15: ReverseSetsForeignTableAndForeignColumnsAndPrimaryTableAndPrimaryColumnsAOnGeneratedExpression

 public void ReverseSetsForeignTableAndForeignColumnsAndPrimaryTableAndPrimaryColumnsAOnGeneratedExpression()
 {
     var expression = new DeleteForeignKeyExpression
     {
         ForeignKey = new ForeignKeyDefinition
         {
             ForeignColumns = new Collection<string> { "ForeignId" },
             ForeignTable = "UserRoles",
             PrimaryColumns = new Collection<string> { "PrimaryId" },
             PrimaryTable = "User",
         }
     };
     var reverse = expression.Reverse() as CreateForeignKeyExpression;
     reverse.ForeignKey.ForeignTable.ShouldBe("User");
     reverse.ForeignKey.PrimaryTable.ShouldBe("UserRoles");
     reverse.ForeignKey.ForeignColumns.First().ShouldBe("PrimaryId");
     reverse.ForeignKey.PrimaryColumns.First().ShouldBe("ForeignId");
 }
开发者ID:BarsBarsovich,项目名称:fluentmigrator,代码行数:18,代码来源:DeleteForeignKeyExpressionTests.cs


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