Convert to new Core 3.0 using declarations
This commit is contained in:
parent
b0fec23a51
commit
1b6c577044
20 changed files with 324 additions and 381 deletions
|
|
@ -10,20 +10,20 @@ namespace DataLayer
|
|||
{
|
||||
public static int BooksWithoutDetailsCount()
|
||||
{
|
||||
using (var context = LibationContext.Create())
|
||||
return context
|
||||
.Books
|
||||
.Count(b => !b.HasBookDetails);
|
||||
}
|
||||
using var context = LibationContext.Create();
|
||||
return context
|
||||
.Books
|
||||
.Count(b => !b.HasBookDetails);
|
||||
}
|
||||
|
||||
public static Book GetBook_Flat_NoTracking(string productId)
|
||||
{
|
||||
using (var context = LibationContext.Create())
|
||||
return context
|
||||
.Books
|
||||
.AsNoTracking()
|
||||
.GetBook(productId);
|
||||
}
|
||||
using var context = LibationContext.Create();
|
||||
return context
|
||||
.Books
|
||||
.AsNoTracking()
|
||||
.GetBook(productId);
|
||||
}
|
||||
|
||||
public static Book GetBook(this IQueryable<Book> books, string productId)
|
||||
=> books
|
||||
|
|
|
|||
|
|
@ -8,22 +8,22 @@ namespace DataLayer
|
|||
{
|
||||
public static List<LibraryBook> GetLibrary_Flat_NoTracking()
|
||||
{
|
||||
using (var context = LibationContext.Create())
|
||||
return context
|
||||
.Library
|
||||
.AsNoTracking()
|
||||
.GetLibrary()
|
||||
.ToList();
|
||||
}
|
||||
using var context = LibationContext.Create();
|
||||
return context
|
||||
.Library
|
||||
.AsNoTracking()
|
||||
.GetLibrary()
|
||||
.ToList();
|
||||
}
|
||||
|
||||
public static LibraryBook GetLibraryBook_Flat_NoTracking(string productId)
|
||||
{
|
||||
using (var context = LibationContext.Create())
|
||||
return context
|
||||
.Library
|
||||
.AsNoTracking()
|
||||
.GetLibraryBook(productId);
|
||||
}
|
||||
using var context = LibationContext.Create();
|
||||
return context
|
||||
.Library
|
||||
.AsNoTracking()
|
||||
.GetLibraryBook(productId);
|
||||
}
|
||||
|
||||
/// <summary>This is still IQueryable. YOU MUST CALL ToList() YOURSELF</summary>
|
||||
public static IQueryable<LibraryBook> GetLibrary(this IQueryable<LibraryBook> library)
|
||||
|
|
|
|||
|
|
@ -13,13 +13,11 @@ namespace _scratch_pad
|
|||
// var user = new Student() { Name = "Dinah Cheshire" };
|
||||
// var udi = new UserDef { UserDefId = 1, TagsRaw = "my,tags" };
|
||||
|
||||
// using (var context = new MyTestContextDesignTimeDbContextFactory().Create())
|
||||
// {
|
||||
// context.Add(user);
|
||||
// //context.Add(udi);
|
||||
// context.Update(udi);
|
||||
// context.SaveChanges();
|
||||
// }
|
||||
// using var context = new MyTestContextDesignTimeDbContextFactory().Create();
|
||||
// context.Add(user);
|
||||
// //context.Add(udi);
|
||||
// context.Update(udi);
|
||||
// context.SaveChanges();
|
||||
|
||||
// Console.WriteLine($"Student was saved in the database with id: {user.Id}");
|
||||
// }
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue