Skip to content

Commit ed3588e

Browse files
dev: EF example
1 parent 57dcc62 commit ed3588e

File tree

2 files changed

+16
-11
lines changed

2 files changed

+16
-11
lines changed

examples/src/EF/Program.cs

Lines changed: 16 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
1-
using Microsoft.EntityFrameworkCore;
2-
using EfCore.Ydb.Extensions;
1+
using EfCore.Ydb.Extensions;
2+
using Microsoft.EntityFrameworkCore;
33

44
await using var db = new BloggingContext();
55

@@ -34,18 +34,24 @@ protected override void OnConfiguring(DbContextOptionsBuilder options)
3434

3535
internal class Blog
3636
{
37-
public int BlogId { get; set; }
38-
public string Url { get; set; }
37+
public int BlogId { get; init; }
3938

40-
public List<Post> Posts { get; } = new();
39+
// ReSharper disable once EntityFramework.ModelValidation.UnlimitedStringLength
40+
public string Url { get; set; } = string.Empty;
41+
42+
// ReSharper disable once CollectionNeverQueried.Global
43+
public List<Post> Posts { get; init; } = [];
4144
}
4245

4346
internal class Post
4447
{
45-
public int PostId { get; set; }
46-
public string Title { get; set; }
47-
public string Content { get; set; }
48+
public int PostId { get; init; }
49+
50+
// ReSharper disable once EntityFramework.ModelValidation.UnlimitedStringLength
51+
public string Title { get; init; } = string.Empty;
52+
53+
// ReSharper disable once EntityFramework.ModelValidation.UnlimitedStringLength
54+
public string Content { get; init; } = string.Empty;
4855

49-
public int BlogId { get; set; }
50-
public Blog Blog { get; set; }
56+
public Blog Blog { get; init; } = null!;
5157
}

src/EfCore.Ydb/src/Query/Internal/YdbQuerySqlGeneratorFactory.cs

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,4 @@
11
using Microsoft.EntityFrameworkCore.Query;
2-
using Microsoft.EntityFrameworkCore.Storage;
32

43
namespace EfCore.Ydb.Query.Internal;
54

0 commit comments

Comments
 (0)