Skip to content

Commit 4a7aae4

Browse files
authored
Update README.md (#203)
some minor typo fixes
1 parent e137919 commit 4a7aae4

File tree

1 file changed

+11
-11
lines changed

1 file changed

+11
-11
lines changed

README.md

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -214,7 +214,7 @@ Console.WriteLine (criteria2.Expand().ToString());
214214
p => ((p.Price > 1000) || p.Description.Contains("a"))
215215
```
216216

217-
Notice that we have a nice clean expression: the call to Invoke has been stripped away.
217+
Notice that we have a nice, clean expression: the call to Invoke has been stripped away.
218218

219219
If you're using an Invoked expression within a LINQ to SQL or Entity Framework query, and have called AsExpandable on the Table, you can optionally skip step 2. This is because AsExpandable automatically calls Expand on expressions. This means either of the following is valid:
220220

@@ -264,9 +264,9 @@ IQueryable<Product> SearchProducts (params string[] keywords)
264264

265265
The temporary variable in the loop is required to avoid the outer variable trap, where the same variable is captured for each iteration of the foreach loop.
266266

267-
So far, so good. But this only handles the case where you want to match all of the specified keywords. Suppose instead, we wanted products whose description contains any of the supplied keywords. Our previous approach of chaining Where operators is completely useless! We could instead chain Union operators, but this would be inefficient. The ideal approach is to dynamically construct a lambda expression tree that performs an or-based predicate.
267+
So far, so good. But this only handles the case where you want to match all of the specified keywords. Suppose instead, we wanted products whose description contains any of the supplied keywords. Our previous approach of chaining Where operators, is completely useless! We could instead chain Union operators, but this would be inefficient. The ideal approach is to dynamically construct a lambda expression tree that performs an or-based predicate.
268268

269-
Of all the things that will drive you to manually constructing expression trees, the need for dynamic predicates is the most common in a typical business application. Fortunately, it’s possible to write a set of simple and reusable extension methods that radically simplify this task. This is the role of our PredicateBuilder class.
269+
Of all the things that will drive you to manually construct expression trees, the need for dynamic predicates is the most common in a typical business application. Fortunately, it’s possible to write a set of simple and reusable extension methods that radically simplify this task. This is the role of our PredicateBuilder class.
270270

271271
## Using PredicateBuilder
272272

@@ -327,13 +327,13 @@ Would be a shortcut for this:
327327
Expression<Func<Product, bool>> predicate = c => false;
328328
```
329329

330-
However, a default we don't want a stub expression. In Entity Framework, this would result in a query having a where statement starting with 1=0, so a if you were checking that value = 'abc', the query's where clause would look as follows;
330+
However, a default we don't want a stub expression. In Entity Framework, this would result in a query having a where statement starting with 1=0, so if you were checking that value = 'abc', the query's where clause would look as follows;
331331

332332
```
333333
WHERE 1=0 OR value = 'abc'
334334
```
335335

336-
ExpressionStarter fixes this. As soon as the first expression is added to ExpressionStarter, the default experssion is removed. You can add the first expression by calling ExpressionStarter's Start method. However, calling Start is not required. If no expression has been added to the ExpressionStarter, then calling And or Or will simply add the first expresion. This is usefull when using loops.
336+
ExpressionStarter fixes this. As soon as the first expression is added to ExpressionStarter, the default expression is removed. You can add the first expression by calling ExpressionStarter's Start method. However, calling Start is not required. If no expression has been added to the ExpressionStarter, then calling And or Or will simply add the first expression. This is useful when using loops.
337337

338338
~~When you’re building a predicate by repeatedly stacking and/or conditions, it’s useful to have a starting point of either true or false (respectively). Our SearchProducts method still works if no keywords are supplied.~~
339339

@@ -509,7 +509,7 @@ public partial class Product : IValidFromTo { }
509509
Complete Example, Getting Started...
510510
=======
511511

512-
Create a database, let's say MyDatabase to your SQL server with script:
512+
Create a database, let's say MyDatabase to your SQL server with a script:
513513

514514
```sql
515515
CREATE TABLE [dbo].[Orders](
@@ -534,7 +534,7 @@ INSERT INTO [dbo].[Orders]([Amount],[OrderDate])
534534
GO
535535
```
536536

537-
Then create a new C# console application. Add references to nuget packages `EntityFramework` and `LinqKit`.
537+
Then, create a new C# console application. Add references to Nuget packages `EntityFramework` and `LinqKit`.
538538

539539
```csharp
540540
using System;
@@ -590,7 +590,7 @@ class Program
590590
}
591591
}
592592
```
593-
Run. Observe with SQL profiler that your `expression` is coming outside the EF-context but still executed to the SQL-query. There are good tutorial videos and materials of SQL profiling in the internet and the profiling is highly recommended. SQL Server Management Studio includes SQL Server Profiler.
593+
Run. Observe with the SQL profiler that your `expression` is coming outside the EF-context but still executed to the SQL query. There are good tutorial videos and materials on SQL profiling on the internet, and the profiling is highly recommended. SQL Server Management Studio includes SQL Server Profiler.
594594

595595
More optimized queries!
596596
=======
@@ -639,10 +639,10 @@ SELECT
639639
',N'@p__linq__0 int,@p__linq__1 int',@p__linq__0=2,@p__linq__1=2
640640
```
641641

642-
As you noticed, there are lot of dynamic parameters. This is good if the parameters vary a lot, but here they are pretty static so SQL-server will not be able to perform all caching optimizations. We could optimize away these variables by runtime when LinqKit forms the query.
642+
As you noticed, there are a lot of dynamic parameters. This is good if the parameters vary a lot, but here, they are pretty static, so the SQL server will not be able to perform all caching optimizations. We could optimize away these variables by runtime when LinqKit forms the query.
643643

644644
There is a project called [Linq.Expression.Optimizer](https://thorium.github.io/Linq.Expression.Optimizer/) and it is supported by LinqKit.
645-
Install this nuget package (and add reference to F#-core library if required).
645+
Install this Nuget package (and add a reference to F#-core library if required).
646646

647647
### Use the static option (all calls)
648648
Make this static call once before executing your queries (e.g. to your app startup or static class constructor or Application_Start):
@@ -704,7 +704,7 @@ Permission has been granted to have this repo be the official source for this pr
704704

705705
Contributing
706706
=======
707-
Just send PullRequests to the this repository.
707+
Just send PullRequests to this repository.
708708
To compile the whole solution you may need .NET Core and UAP installed.
709709

710710
License

0 commit comments

Comments
 (0)