Пример #1
0
        public void delete_with_schema_from_fluent_API()
        {
            using (var db = new FluentApiContext("someApiSchema"))
            {
                var sql = db.Posts
                          .Where(x => x.Id == 1)
                          .GenerateBulkDeleteSql();

                Assert.Equal(@"DELETE FROM [someApiSchema].[Posts]
WHERE [Posts].[Id] = 1;", sql, false, true, false);
            }
        }
Пример #2
0
        public void update_with_schema_from_fluent_API()
        {
            using (var db = new FluentApiContext("someApiSchema"))
            {
                var sql = db.Posts
                          .Where(x => x.Id == 1)
                          .SetField(x => x.IsPinned).WithValue(true)
                          .SetField(x => x.IsHighlighted).WithValue(true)
                          .GenerateBulkUpdateSql();

                Assert.Equal(@"UPDATE [someApiSchema].[Posts]
SET [Posts].[IsPinned] = {0}, 
    [Posts].[IsHighlighted] = {1}
WHERE [Posts].[Id] = 1;", sql, false, true, false);
            }
        }