コード例 #1
0
        public void delete_with_schema_from_data_annotation()
        {
            using (var db = new DataAnnotationContext())
            {
                var sql = db.Products
                          .Where(x => x.Id == 1)
                          .GenerateBulkDeleteSql();

                Assert.Equal(@"DELETE FROM [someAttributeSchema].[Products]
WHERE [Products].[Id] = 1;", sql, false, true, false);
            }
        }
コード例 #2
0
ファイル: UpdateTests.cs プロジェクト: graemechristie/Lolita
        public void update_with_schema_from_data_annotation()
        {
            using (var db = new DataAnnotationContext())
            {
                var sql = db.Products
                          .Where(x => x.Id == 1)
                          .SetField(x => x.Name).WithValue("some name")
                          .SetField(x => x.Description).WithValue("some description")
                          .GenerateBulkUpdateSql();

                Assert.Equal(@"UPDATE [someAttributeSchema].[Products]
SET [Products].[Name] = {0}, 
    [Products].[Description] = {1}
WHERE [Products].[Id] = 1;", sql, false, true, false);
            }
        }