Son aktivite 11 months ago

emildr bu gisti düzenledi 11 months ago. Düzenlemeye git

1 file changed, 3 insertions, 3 deletions

insta_pr_decline.md

@@ -17,7 +17,7 @@ foreach (var id in itemIds)
17 17 Correct:
18 18 ```C#
19 19 var items = await _context.Items.Where(x => itemIds.Contains(x.Id)).AsAsyncEnumerable();
20 - foreach (var item in items)
20 + await foreach (var item in items)
21 21 {
22 22 // Logic
23 23 }
@@ -31,7 +31,7 @@ If you don't know if you need it, you need it.
31 31 Incorrect
32 32 ```C#
33 33 var items = await _context.Items.Where(x => itemIds.Contains(x.Id)).AsAsyncEnumerable();
34 - foreach (var item in items)
34 + await foreach (var item in items)
35 35 {
36 36 // Logic
37 37 }
@@ -45,7 +45,7 @@ await using var transaction = await context.Database.BeginTransactionAsync();
45 45 try
46 46 {
47 47 var items = await _context.Items.Where(x => itemIds.Contains(x.Id)).AsAsyncEnumerable();
48 - foreach (var item in items)
48 + await foreach (var item in items)
49 49 {
50 50 // Logic
51 51 }

emildr bu gisti düzenledi 11 months ago. Düzenlemeye git

1 file changed, 2 insertions, 2 deletions

insta_pr_decline.md

@@ -71,7 +71,7 @@ await _context.Users
71 71 .Include(u => u.Events)
72 72 .Include(u => u.Installations)
73 73 .ThenInclude(i => i.Meters)
74 - .ToListAsync();
74 + .AsAsyncEnumerable();
75 75 ```
76 76
77 77 Correct:
@@ -82,7 +82,7 @@ await _context.Users
82 82 .Include(u => u.Installations)
83 83 .ThenInclude(i => i.Meters)
84 84 .AsSplitQuery()
85 - .ToListAsync();
85 + .AsAsyncEnumerable();
86 86 ```
87 87
88 88 ## Todos without issues

emildr bu gisti düzenledi 11 months ago. Düzenlemeye git

1 file changed, 4 insertions, 1 deletion

insta_pr_decline.md

@@ -104,4 +104,7 @@ var theThing = getTheThing(); // TODO: Do the right thing! (#8383)
104 104
105 105 ## Big/frequent queries without indexes
106 106
107 - If you are executing a query a lot. It must have an index.
107 + If you are executing a query a lot. It must have an index.
108 +
109 + ## Compiler warnings
110 + No further explanation needed.

emildr bu gisti düzenledi 11 months ago. Düzenlemeye git

1 file changed, 3 insertions

insta_pr_decline.md

@@ -99,6 +99,9 @@ Correct
99 99 var theThing = getTheThing(); // TODO: Do the right thing! (#8383)
100 100 ```
101 101
102 + ## Not using async/await in EF Core
103 + [EF core does not support parallel queries on the same context instance](https://learn.microsoft.com/en-us/ef/core/miscellaneous/async)
104 +
102 105 ## Big/frequent queries without indexes
103 106
104 107 If you are executing a query a lot. It must have an index.

emildr bu gisti düzenledi 11 months ago. Düzenlemeye git

1 file changed, 1 insertion, 1 deletion

insta_pr_decline.md

@@ -62,7 +62,7 @@ catch (Exception e)
62 62
63 63 ## 3+ Includes without AsSplitQuery() (without a select)
64 64
65 - **Always** consider the query that will actually be executed. This will most often result in a cartesian explosion.
65 + **Always** consider the query that will actually be executed. This will most often result in a [cartesian explosion](https://learn.microsoft.com/en-us/ef/core/querying/single-split-queries).
66 66
67 67 Incorrect
68 68 ```C#

emildr bu gisti düzenledi 11 months ago. Düzenlemeye git

1 file changed, 2 insertions, 2 deletions

insta_pr_decline.md

@@ -60,9 +60,9 @@ catch (Exception e)
60 60 }
61 61 ```
62 62
63 - ## 3+ Includes without AsSplitQuery()
63 + ## 3+ Includes without AsSplitQuery() (without a select)
64 64
65 - **Always** consider the query that will actually be executed.
65 + **Always** consider the query that will actually be executed. This will most often result in a cartesian explosion.
66 66
67 67 Incorrect
68 68 ```C#

emildr bu gisti düzenledi 11 months ago. Düzenlemeye git

1 file changed, 3 insertions, 3 deletions

insta_pr_decline.md

@@ -16,7 +16,7 @@ foreach (var id in itemIds)
16 16
17 17 Correct:
18 18 ```C#
19 - var items = await _context.Items.Where(x => itemIds.Contains(x.Id));
19 + var items = await _context.Items.Where(x => itemIds.Contains(x.Id)).AsAsyncEnumerable();
20 20 foreach (var item in items)
21 21 {
22 22 // Logic
@@ -30,7 +30,7 @@ If you don't know if you need it, you need it.
30 30
31 31 Incorrect
32 32 ```C#
33 - var items = await _context.Items.Where(x => itemIds.Contains(x.Id));
33 + var items = await _context.Items.Where(x => itemIds.Contains(x.Id)).AsAsyncEnumerable();
34 34 foreach (var item in items)
35 35 {
36 36 // Logic
@@ -44,7 +44,7 @@ await using var transaction = await context.Database.BeginTransactionAsync();
44 44
45 45 try
46 46 {
47 - var items = await _context.Items.Where(x => itemIds.Contains(x.Id));
47 + var items = await _context.Items.Where(x => itemIds.Contains(x.Id)).AsAsyncEnumerable();
48 48 foreach (var item in items)
49 49 {
50 50 // Logic

emildr bu gisti düzenledi 11 months ago. Düzenlemeye git

1 file changed, 1 insertion, 1 deletion

insta_pr_decline.md

@@ -24,7 +24,7 @@ foreach (var item in items)
24 24 await _context.SaveChangesAsync();
25 25 ```
26 26
27 - ## 2+ Queries updating/inserting queries without a transaction
27 + ## 2+ Queries updating/inserting without a transaction
28 28
29 29 If you don't know if you need it, you need it.
30 30

emildr bu gisti düzenledi 11 months ago. Düzenlemeye git

Değişiklik yok

emildr bu gisti düzenledi 11 months ago. Düzenlemeye git

1 file changed, 2 insertions

insta_pr_decline.md

@@ -89,10 +89,12 @@ await _context.Users
89 89
90 90 You **will** forget.
91 91
92 + Incorrect
92 93 ```C#
93 94 var theThing = getTheThing(); // TODO: Do the right thing!
94 95 ```
95 96
97 + Correct
96 98 ```C#
97 99 var theThing = getTheThing(); // TODO: Do the right thing! (#8383)
98 100 ```
Daha yeni Daha eski