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


C# Expressions.DeleteDataExpression类代码示例

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


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

示例1: DeleteVersion

 public void DeleteVersion(long version)
 {
     var expression = new DeleteDataExpression {TableName = VersionTableMetaData.TableName, SchemaName = VersionTableMetaData.SchemaName};
     expression.Rows.Add(new DeletionDataDefinition
     {
         new KeyValuePair<string, object>(VersionTableMetaData.ColumnName, version)
     });
     expression.ExecuteWith(Processor);
 }
开发者ID:SaltyDH,项目名称:fluentmigrator,代码行数:9,代码来源:ConnectionlessVersionLoader.cs

示例2: Reverse

        public IMigrationExpression Reverse()
        {
            var expression = new DeleteDataExpression
                                {
                                    SchemaName = SchemaName,
                                    TableName = TableName,
                                };

            expression.Rows.AddRange(Rows);

            return expression;
        }
开发者ID:ibebbs,项目名称:fluentmigrator,代码行数:12,代码来源:InsertDataExpression.cs

示例3: Reverse

        public IMigrationExpression Reverse()
        {
            var expression = new DeleteDataExpression
                                {
                                    SchemaName = SchemaName,
                                    TableName = TableName
                                };

            foreach (var row in Rows)
            {
                var dataDefinition = new DeletionDataDefinition();
                dataDefinition.AddRange(row);

                expression.Rows.Add(dataDefinition);
            }

            return expression;
        }
开发者ID:rebootd,项目名称:fluentmigrator,代码行数:18,代码来源:InsertDataExpression.cs

示例4: CanDeleteAllData

        public void CanDeleteAllData()
        {
            var expression = new DeleteDataExpression
                                 {
                                     IsAllRows=true, TableName = "Table1"
                                 };

            var sql = generator.Generate(expression);
            sql.ShouldBe("DELETE FROM \"public\".\"Table1\";");
        }
开发者ID:timscott,项目名称:fluentmigrator,代码行数:10,代码来源:PostgresGeneratorTests.cs

示例5: Generate

        public override string Generate(DeleteDataExpression expression)
        {
            var deleteItems = new List<string>();

            if (expression.IsAllRows)
            {
                deleteItems.Add(string.Format(DeleteData, Quoter.QuoteTableName(expression.TableName), "1 = 1"));
            }
            else
            {
                foreach (var row in expression.Rows)
                {
                    var whereClauses = new List<string>();
                    foreach (KeyValuePair<string, object> item in row)
                    {
                        whereClauses.Add(string.Format("{0} {1} {2}", Quoter.QuoteColumnName(item.Key), item.Value == null ? "IS" : "=", Quoter.QuoteValue(item.Value)));
                    }

                    deleteItems.Add(string.Format(DeleteData, Quoter.QuoteTableName(expression.TableName), String.Join(" AND ", whereClauses.ToArray())));
                }
            }

            return String.Join("; ", deleteItems.ToArray());
        }
开发者ID:robertmircea,项目名称:fluentmigrator,代码行数:24,代码来源:GenericGenerator.cs

示例6: Generate

        public override string Generate(DeleteDataExpression expression)
        {
            var result = new StringBuilder();
            foreach (var row in expression.Rows)
            {
                var where = String.Empty;
                var i = 0;

                foreach (var item in row)
                {
                    if (i != 0)
                    {
                        where += " AND ";
                    }

                    where += String.Format("[{0}] {1} {2}", item.Key, item.Value == null ? "IS" : "=", Constant.Format(item.Value));
                    i++;
                }

                result.Append(String.Format("DELETE FROM {0} WHERE {1};", expression.TableName, where));
            }
            return result.ToString();
        }
开发者ID:jtreuting,项目名称:fluentmigrator,代码行数:23,代码来源:OracleGenerator.cs

示例7: Process

 public void Process(DeleteDataExpression expression)
 {
     Process(Generator.Generate(expression));
 }
开发者ID:Ang3lFir3,项目名称:fluentmigrator,代码行数:4,代码来源:ProcessorBase.cs

示例8: GetDeleteDataAllRowsExpression

 public static DeleteDataExpression GetDeleteDataAllRowsExpression()
 {
     var expression = new DeleteDataExpression();
     expression.TableName = TestTableName1;
     expression.IsAllRows = true;
     return expression;
 }
开发者ID:hazzik,项目名称:fluentmigrator,代码行数:7,代码来源:GeneratorTestHelper.cs

示例9: Generate

        public override string Generate(DeleteDataExpression expression)
        {
            var result = new StringBuilder();

            if (expression.IsAllRows)
            {
                result.Append(String.Format("DELETE FROM {0}[{1}];", FormatSchema(expression.SchemaName), expression.TableName));
            }
            else
            {
                foreach (var row in expression.Rows)
                {
                    var where = String.Empty;
                    var i = 0;

                    foreach (var item in row)
                    {
                        if (i != 0)
                        {
                            where += " AND ";
                        }

                        where += String.Format("[{0}] = {1}", item.Key, Constant.Format(item.Value));
                        i++;
                    }

                    result.Append(String.Format("DELETE FROM {0}[{1}] WHERE {2};", FormatSchema(expression.SchemaName), expression.TableName, where));
                }
            }

            return result.ToString();
        }
开发者ID:nats,项目名称:fluentmigrator,代码行数:32,代码来源:SqlServer2000Generator.cs

示例10: CanDeleteTestFromTable

        public void CanDeleteTestFromTable()
        {
            CanInsertAndReadDataFromTestTable();

             var delete = new DeleteDataExpression {TableName = "Foo"};
             delete.Rows.Add(new DeletionDataDefinition {
            new KeyValuePair<string, object>("Id", 1)
            });

             _processor.Process(delete);

             var table = _processor.ReadTableData(string.Empty, "Foo");

             0.ShouldBe(table.Tables[0].Rows.Count);
        }
开发者ID:garchibald,项目名称:fluentmigrator,代码行数:15,代码来源:OracleProcessorTests.cs

示例11: DeleteVersion

 public void DeleteVersion(long version)
 {
     var expression = new DeleteDataExpression { TableName = VersionTableMetaData.TableName, SchemaName = VersionTableMetaData.SchemaName };
     expression.Rows.Add(new ExplicitDataDefinition(new DataValue(VersionTableMetaData.ColumnName, version)));
     expression.ExecuteWith(Processor);
 }
开发者ID:ibebbs,项目名称:fluentmigrator,代码行数:6,代码来源:VersionLoader.cs

示例12: Generate

 public override string Generate(DeleteDataExpression expression)
 {
     return string.Format("{0};", base.Generate(expression));
 }
开发者ID:SaltyDH,项目名称:fluentmigrator,代码行数:4,代码来源:HanaGenerator.cs

示例13: Generate

        public override string Generate(DeleteDataExpression expression)
        {
            var deleteItems = new List<string>();

            if (expression.IsAllRows)
            {
                deleteItems.Add(string.Format(DeleteData, Quoter.QuoteTableName(expression.TableName), "1 = 1", CommandDelimiter));
            }
            else
            {
                foreach (var row in expression.Rows)
                {
                    IEnumerable<IDataValue> columnData = evaluator.Evaluate(row);

                    var whereClauses = new List<string>();

                    foreach (IDataValue item in columnData)
                    {
                        whereClauses.Add(string.Format("{0} {1} {2}", Quoter.QuoteColumnName(item.ColumnName), item.Value == null ? "IS" : "=", Quoter.QuoteDataValue(item)));
                    }

                    deleteItems.Add(string.Format(DeleteData, Quoter.QuoteTableName(expression.TableName), String.Join(" AND ", whereClauses.ToArray()), CommandDelimiter));
                }
            }

            return String.Join(MultilineDelimiter, deleteItems.ToArray());
        }
开发者ID:ibebbs,项目名称:fluentmigrator,代码行数:27,代码来源:GenericGenerator.cs

示例14: Truncate

 public void Truncate(DeleteDataExpression expression)
 {
     expression.TableName = Truncate(expression.TableName);
 }
开发者ID:ibebbs,项目名称:fluentmigrator,代码行数:4,代码来源:FirebirdTruncator.cs

示例15: Generate

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


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