Skip to content

Commit 178966a

Browse files
2 parents 7c1c64e + 374d82d commit 178966a

File tree

6 files changed

+56
-14
lines changed

6 files changed

+56
-14
lines changed

.github/ISSUE_TEMPLATE.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,25 @@
1+
### Description
2+
Describe the issue or proposed feature.
3+
4+
### Exception
5+
If you are seeing an exception, include the full exceptions details (message and stack trace).
6+
7+
```
8+
Exception message:
9+
Stack trace:
10+
```
11+
12+
### Fiddle or Project
13+
Create a Fiddle that reproduces the issue: https://dotnetfiddle.net/zB4SGA
14+
15+
Or provide a project/solution that we can run to reproduce the issue.
16+
- Make sure the project compile
17+
- Make sure to provide only the code that is required to reproduce the issue, not the whole project
18+
- You can send private code here: [email protected]
19+
20+
_Note: If you are not able to provide code we can run and that reproduce the issue, we will not be able to fix it either._
21+
22+
### Further technical details
23+
- EF version:
24+
- EF Plus version:
25+
- Database Provider:

docs2/pages/documentations/linq-dynamic.md

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,6 +33,7 @@ var list = ctx.Where(x => "x > 2").ToList();
3333
var list = ctx.Where(x => "x > y", new { y = 2 }).ToList();
3434

3535
```
36+
{% include component-try-it.html href='https://dotnetfiddle.net/Otm0Aa' %}
3637

3738
## Order && Select
3839

@@ -48,14 +49,11 @@ All LINQ selector and order are supported. Most of them require the "Dynamic" su
4849
{% include template-example.html %}
4950
```csharp
5051

51-
var list = ctx.SelectDynamic(x => "new { y = x + 1 }").ToList();
52-
var list = ctx.SelectDynamic(x => "new { y = x + 1 }", new { y = 1 }).ToList();
53-
var list = new List<int>() { 5, 2, 4, 1, 3 };
54-
55-
var list2 = list.OrderByDynamic(x => "x + 1");
56-
var list3 = list.OrderByDynamic(x => "x + y", new { y = 1 });
52+
var list = context.Customers.OrderByDescendingDynamic(x => "x.Name").ToList();
53+
var list = context.Customers.SelectDynamic(x => "x.Name").ToList();
5754

5855
```
56+
{% include component-try-it.html href='https://dotnetfiddle.net/OJjBgK' %}
5957

6058
## Execute
6159

@@ -71,3 +69,4 @@ var list = ctx.Execute<IEnumerable<int>>("Where(x => x > 2)");
7169
var list3 = ctx.Execute("Where(x => x > y).OrderBy(x => x).ToList()", new { y = 2 });
7270

7371
```
72+
{% include component-try-it.html href='https://dotnetfiddle.net/mwTqW7' %}

docs2/pages/documentations/query-cache.md

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -25,6 +25,7 @@ var countries1 = ctx.Countries.FromCache().ToList();
2525
var countries2 = ctx.Countries.FromCache().ToList();
2626

2727
```
28+
{% include component-try-it.html href='https://dotnetfiddle.net/nx9A2H' %}
2829

2930
## EF+ Query Cache
3031

@@ -43,6 +44,7 @@ var countries = ctx.Countries.Where(x => x.IsActive).FromCache();
4344
var states = ctx.States.Where(x => x.IsActive).FromCache(DateTime.Now.AddHours(2));
4445

4546
```
47+
{% include component-try-it.html href='https://dotnetfiddle.net/BcScGT' %}
4648

4749
## EF+ Query Cache Async
4850

@@ -77,6 +79,7 @@ var count = ctx.Customers.Count();
7779
// Oops! All customers are cached instead of customer count.
7880
var count = ctx.Customers.FromCache().Count();
7981
```
82+
{% include component-try-it.html href='https://dotnetfiddle.net/SOjxeY' %}
8083

8184
**EF+ Query Deferred** has been created to resolve this issue, the resolution is now deferred instead of being immediate which lets us cache the expected result.
8285

@@ -89,6 +92,7 @@ var ctx = new EntitiesContext();
8992
var count = ctx.Customers.DeferredCount().FromCache();
9093

9194
```
95+
{% include component-try-it.html href='https://dotnetfiddle.net/4MUlef' %}
9296

9397
Query Deferred supports all Queryable extension methods and overloads.
9498

@@ -113,6 +117,7 @@ QueryCacheManager.ExpireTag("countries");
113117
:bulb: Use Enum instead of hard-coding string for tag name.
114118

115119
```
120+
{% include component-try-it.html href='https://dotnetfiddle.net/RScINk' %}
116121

117122
## EF+ Query Cache Expiration
118123

@@ -134,6 +139,7 @@ var options = new MemoryCacheEntryOptions() { SlidingExpiration = TimeSpan.FromH
134139
var states = ctx.States.FromCache(options);
135140

136141
```
142+
{% include component-try-it.html href='https://dotnetfiddle.net/f57ZoI' %}
137143

138144
## EF Query Cache Control
139145

@@ -151,6 +157,7 @@ QueryCacheManager.Cache = MemoryCache.Default;
151157
QueryCacheManager.Cache = new MemoryCache(new MemoryCacheOptions());
152158

153159
```
160+
{% include component-try-it.html href='https://dotnetfiddle.net/mIhcff' %}
154161

155162
You can set default policy
156163

@@ -166,6 +173,7 @@ var options = new MemoryCacheEntryOptions() { SlidingExpiration = TimeSpan.FromH
166173
QueryCacheManager.DefaultMemoryCacheEntryOptions = options;
167174

168175
```
176+
{% include component-try-it.html href='https://dotnetfiddle.net/7JptcT' %}
169177

170178
## Real Life Scenarios
171179

docs2/pages/documentations/query-db-set-filter.md

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -41,6 +41,7 @@ QueryDbSetFilterManager.InitilizeGlobalFilter(ctx);
4141
var list = ctx.Customers.ToList();
4242

4343
```
44+
{% include component-try-it.html href='https://dotnetfiddle.net/HijoZX' %}
4445

4546
***Use entities context constructor to initialize global filter by default.***
4647

@@ -60,6 +61,7 @@ ctx.DbSetFilter<Customer>(q => q.Where(x => x.IsActive));
6061
var list = ctx.Customers.ToList();
6162

6263
```
64+
{% include component-try-it.html href='https://dotnetfiddle.net/3Xz39f' %}
6365

6466
***Use entities context constructor to make some filter "global" to all context.***
6567

@@ -76,10 +78,11 @@ var ctx = new EntitiesContext();
7678
// CREATE a disabled filter
7779
ctx.DbSetFilter<Customer>(MyEnum.EnumValue, q => q.Where(x => x.IsActive), false);
7880

79-
// SELECT * FROM Customer WHERE IsActive = true
81+
// SELECT * FROM Customer
8082
var list = ctx.Customers.DbSetFilter(MyEnum.EnumValue).ToList();
8183

8284
```
85+
{% include component-try-it.html href='https://dotnetfiddle.net/XmtVWN' %}
8386

8487
## EF+ Query Filter By Inheritance/Interface
8588

@@ -97,13 +100,14 @@ ctx.DbSetFilter<BaseDog>(q => q.Where(x => !x.IsDangerous));
97100
// CREATE filter by interface
98101
ctx.DbSetFilter<IAnimal>(q => q.Where(x => x.IsDomestic));
99102

100-
// SELECT * FROM Cat WHERE IsDomestic = true
103+
// SELECT * FROM Cat WHERE IsDomestic = 1
101104
var cats = ctx.Cats.ToList();
102105

103-
// SELECT * FROM Dog WHERE IsDomestic = true AND IsDangerous = false
106+
// SELECT * FROM Dog WHERE IsDomestic = 1 AND IsDangerous = 0
104107
var dogs = ctx.Dogs.ToList();
105108

106109
```
110+
{% include component-try-it.html href='https://dotnetfiddle.net/flFnBf' %}
107111

108112
## EF+ Query Filter Enable/Disable
109113

@@ -118,19 +122,20 @@ var ctx = new EntitiesContext();
118122
// CREATE filter by interface
119123
ctx.DbSetFilter<IAnimal>(MyEnum.EnumValue, q => q.Where(x => x.IsDomestic))
120124

121-
// DISABLE filter only for class inheriting from BaseDog
122-
ctx.DbSetFilter<BaseDog>(MyEnum.EnumValue).Disable();
125+
// DISABLE filter
126+
ctx.DbSetFilter(MyEnum.EnumValue).Disable();
123127

124128
// SELECT * FROM Dog
125-
var dogs = ctx.Dogs.ToList();
129+
var dogs = ctx.Dogs.ToList();
126130

127131
// ENABLE filter
128-
ctx.DbSetFilter<BaseDog>(MyEnum.EnumValue).Enable();
132+
ctx.DbSetFilter(MyEnum.EnumValue).Enable();
129133

130134
// SELECT * FROM Dog WHERE IsDomestic = true
131135
var dogs = ctx.Dogs.ToList();
132136

133137
```
138+
{% include component-try-it.html href='https://dotnetfiddle.net/girbYB' %}
134139

135140
## EF+ Query Filter AsNoFilter
136141

@@ -151,3 +156,4 @@ var list = ctx.Customers.ToList();
151156
var list = ctx.Customers.AsNoDbSetFilter().ToList();
152157

153158
```
159+
{% include component-try-it.html href='https://dotnetfiddle.net/ZIA1kt' %}

docs2/pages/documentations/query-deferred.md

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ var count = ctx.Customers.Count();
2222
var count = ctx.Customers.FromCache().Count();
2323

2424
```
25+
{% include component-try-it.html href='https://dotnetfiddle.net/WgpFfH' %}
2526

2627
Here comes in play the deferred query which acts exactly like deferred methods, by modifying the query expression without resolving it.
2728

@@ -35,6 +36,7 @@ var ctx = new EntitiesContext();
3536
var count = ctx.Customers.DeferredCount().FromCache();
3637

3738
```
39+
{% include component-try-it.html href='https://dotnetfiddle.net/ZChhmD' %}
3840

3941
#### All LINQ IQueryable extension methods and overloads are supported:
4042

@@ -75,6 +77,7 @@ ctx.Customers.DeferredCount().FromCache();
7577
ctx.Customers.DeferredCount().FutureValue();
7678

7779
```
80+
{% include component-try-it.html href='https://dotnetfiddle.net/5KcNj3' %}
7881

7982
## EF+ Query Deferred Execute
8083

@@ -90,6 +93,7 @@ var countDeferred = ctx.Customers.DeferredCount();
9093
var count = countDeferred.Execute();
9194

9295
```
96+
{% include component-try-it.html href='https://dotnetfiddle.net/sXOfNB' %}
9397

9498
## EF+ Query Deferred Execute Async
9599

docs2/pages/documentations/query-include-filter.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -120,7 +120,7 @@ When an immediate method is invoked to resolve the query, the initial query is m
120120
{% include template-example.html %}
121121
```csharp
122122

123-
var list = ctx.Orders.IncludeFilter(x => x.OrderItems.Where(y => !y.IsSoftDeleted)
123+
var list = ctx.Orders.IncludeFilter(x => x.OrderItems.Where(y => !y.IsSoftDeleted))
124124
.Take(10)
125125
.ToList();
126126

0 commit comments

Comments
 (0)