Skip to content

Commit 64620c2

Browse files
Fix namespace typo and modernize sample data generation
Corrected 'ConfictHandling' to 'ConflictHandling' across files. Updated sample data creation to use C# 12 collection expressions for improved clarity and conciseness.
1 parent e2d6f82 commit 64620c2

6 files changed

Lines changed: 8 additions & 10 deletions

File tree

2_Libs/EFCore/ConflictHandling-FirstWins/Book.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
using System.ComponentModel.DataAnnotations;
2-
namespace ConfictHandling;
2+
namespace ConflictHandling;
33

44
public class Book(string title, string? publisher = default, int bookId = default)
55
{

2_Libs/EFCore/ConflictHandling-FirstWins/BooksContext.cs

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace ConfictHandling;
1+
namespace ConflictHandling;
22

33
public class BooksContext(DbContextOptions<BooksContext> options) : DbContext(options)
44
{
@@ -14,8 +14,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
1414
}
1515

1616
private static IEnumerable<Book> GetSampleBooks()
17-
=> Enumerable.Range(1, 100)
18-
.Select(id => new Book($"title {id}", "sample", id)).ToArray();
17+
=> [.. Enumerable.Range(1, 100).Select(id => new Book($"title {id}", "sample", id))];
1918

2019
public DbSet<Book> Books => Set<Book>();
2120
}

2_Libs/EFCore/ConflictHandling-FirstWins/GlobalUsings.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
global using ConfictHandling;
1+
global using ConflictHandling;
22

33
global using Microsoft.EntityFrameworkCore;
44
global using Microsoft.EntityFrameworkCore.ChangeTracking;

2_Libs/EFCore/ConflictHandling-FirstWins/Runner.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
namespace ConfictHandling;
1+
namespace ConflictHandling;
22

33
public class Runner(BooksContext booksContext)
44
{

2_Libs/EFCore/ConflictHandling-LastWins/BooksContext.cs

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,8 +10,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
1010
}
1111

1212
private Book[] GetSampleBooks()
13-
=> Enumerable.Range(1, 100)
14-
.Select(id => new Book($"title {id}", "sample", id)).ToArray();
13+
=> [.. Enumerable.Range(1, 100).Select(id => new Book($"title {id}", "sample", id))];
1514

1615
public DbSet<Book> Books => Set<Book>();
1716
}

2_Libs/EFCore/Models/MenusContext.cs

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@ protected override void OnModelCreating(ModelBuilder modelBuilder)
3737
private IEnumerable<dynamic> GetInitialMenus(dynamic card, Guid restaurantId)
3838
{
3939
DateTime now = DateTime.Now;
40-
return Enumerable.Range(1, 20).Select(id => new
40+
return [.. Enumerable.Range(1, 20).Select(id => new
4141
{
4242
MenuItemId = id,
4343
Text = $"menu {id}",
@@ -46,7 +46,7 @@ private IEnumerable<dynamic> GetInitialMenus(dynamic card, Guid restaurantId)
4646
LastUpdated = now,
4747
card.MenuCardId,
4848
RestaurantId = restaurantId
49-
}).ToArray();
49+
})];
5050
}
5151

5252
public override Task<int> SaveChangesAsync(CancellationToken cancellationToken = default)

0 commit comments

Comments
 (0)