You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/README.md
+28-22Lines changed: 28 additions & 22 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -1,36 +1,36 @@
1
1
# QueryableValues
2
2
3
-
This library allows us to efficiently compose an [IEnumerable<T>] in our[Entity Framework Core] queries when using the [SQL Server Database Provider]. This is done by using the `AsQueryableValues` extension method that is made available on the [DbContext] class. Everything is evaluated on the server with a single roundtrip, in a way that preserves the query's [execution plan], even when the values behind the [IEnumerable<T>] are changed on subsequent executions.
3
+
This library allows you to efficiently compose an [IEnumerable<T>] in your[Entity Framework Core] queries when using the [SQL Server Database Provider]. This is accomplished by using the `AsQueryableValues` extension method available on the [DbContext] class. Everything is evaluated on the server with a single round trip, in a way that preserves the query's [execution plan], even when the values behind the [IEnumerable<T>] are changed on subsequent executions.
- Can be a userdefined class or struct, with read/write properties and a public constructor.
10
-
- Must have one or more simple type properties.
9
+
- Can be a user-defined class or struct with read/write properties and a public constructor.
10
+
- Must have one or more simple type properties, including [Boolean].
11
11
12
12
For a detailed explanation, please continue reading [here][readme-background].
13
13
14
-
## When Should I Use It?
15
-
The `AsQueryableValues` extension method is intended for queries that are dependent on a *non-constant* sequence of external values. In this case, the underline SQL query will be efficient on subsequent executions.
14
+
## When Should You Use It?
15
+
The `AsQueryableValues` extension method is intended for queries that are dependent upon a *non-constant* sequence of external values. In such cases, the underlying SQL query will be efficient on subsequent executions.
16
16
17
-
It provides a solution to the following long standing EF Core [issue](https://github.com/dotnet/efcore/issues/13617) and enables other currently unsupported scenarios; like the ability to efficiently create joins with in-memory data.
17
+
It provides a solution to the following long standing [EF Core issue](https://github.com/dotnet/efcore/issues/13617) and enables other currently unsupported scenarios; like the ability to efficiently create joins with in-memory data.
18
18
19
19
## Getting Started
20
20
21
21
### Installation
22
-
QueryableValues is distributed as a [NuGet Package]. The major version number of this library is aligned with the version of [Entity Framework Core]that's supported by it; for example, if you are using EF Core 5, then you must use version 5 of QueryableValues.
22
+
QueryableValues is distributed as a [NuGet Package]. The major version number of this library is aligned with the version of [Entity Framework Core]by which it's supported (e.g. If you are using EF Core 5, then you must use version 5 of QueryableValues).
23
23
24
24
Please choose the appropriate command below to install it using the NuGet Package Manager Console window in Visual Studio:
Look for the place in your code where you are setting up your [DbContext] and calling the [UseSqlServer] extension method, then use a lambda expression to access the `SqlServerDbContextOptionsBuilder` provided by it. It is on this builder that you must call the `UseQueryableValues` extension method, as shown in the following simplified examples:
33
+
Look for the place in your code where you are setting up your [DbContext] and calling the [UseSqlServer] extension method, then use a lambda expression to access the `SqlServerDbContextOptionsBuilder` provided by it. It is on this builder that you must call the `UseQueryableValues` extension method as shown in the following simplified examples:
34
34
35
35
When using the `OnConfiguring` method inside your [DbContext]:
36
36
```c#
@@ -71,13 +71,13 @@ public class Startup
71
71
}
72
72
```
73
73
74
-
### How Do I Use It?
75
-
The `AsQueryableValues` extension method is provided by the `BlazarTech.QueryableValues` namespace, therefore, you must add the following `using` directive to your source code file in order for it to appear as a method of your [DbContext] instance:
74
+
### How Do You Use It?
75
+
The `AsQueryableValues` extension method is provided by the `BlazarTech.QueryableValues` namespace; therefore, you must add the following `using` directive to your source code file for it to appear as a method of your [DbContext] instance:
76
76
```
77
77
using BlazarTech.QueryableValues;
78
78
```
79
79
80
-
Below you can find a few examples composing a query using the values provided by an [IEnumerable<T>].
80
+
Below are a few examples composing a query using the values provided by an [IEnumerable<T>].
81
81
82
82
#### Simple Type Examples
83
83
Using the [Contains][ContainsQueryable] LINQ method:
@@ -138,10 +138,11 @@ var myQuery2 =
138
138
i.PropA
139
139
});
140
140
```
141
-
#### Complex Type Examples
141
+
#### Complex Type Example
142
142
```c#
143
-
// If your IEnumerable<T> variable's item type is a complex type with many properties,
144
-
// project only what you need to a new variable and use it in your query.
143
+
// Performance Tip:
144
+
// If your IEnumerable<T> item type (T) has many properties, project only
145
+
// the ones you need to a new variable and use it in your query.
> :warning: All the data provided by this type is transmitted to the server, therefore, ensure that it only contains the properties that you need for your query. Not following this recommendation will degrade the query's performance.
158
+
> :warning: All the data provided by this type is transmitted to the server; therefore, ensure that it only contains the properties you need for your query. Not following this recommendation will degrade the query's performance.
158
159
159
-
> :warning: There is a limit of up to ten properties for any given simple type (e.g., cannot have more than ten[Int32] properties). Exceeding that limit will cause an exception and may also be a sign that you should rethink your strategy.
160
+
> :warning: There is a limit of up to 10 properties for any given simple type (e.g. cannot have more than 10[Int32] properties). Exceeding that limit will cause an exception and may also suggest that you should rethink your strategy.
160
161
161
-
## Do You Want to Know More? 📚
162
-
Please take a look at the repository [here](https://github.com/yv989c/BlazarTech.QueryableValues).
162
+
## Do You Want To Know More? 📚
163
+
Please take a look at the [repository](https://github.com/yv989c/BlazarTech.QueryableValues).
0 commit comments