Skip to content

Commit

Permalink
Merge pull request #2 from Lempireqc/master
Browse files Browse the repository at this point in the history
many change v2
  • Loading branch information
JonathanMagnan committed Mar 24, 2018
2 parents 6c9ca52 + 1c7eaee commit ea70846
Show file tree
Hide file tree
Showing 33 changed files with 241 additions and 204 deletions.
2 changes: 1 addition & 1 deletion docs/CNAME
Original file line number Diff line number Diff line change
@@ -1 +1 @@
linqtosql-plus.net
linqtosql-plus.net
3 changes: 2 additions & 1 deletion docs/_includes/custom/section-aside.html
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
<br />
<!-- <br />
<nav class="card card-box card-box-light card-box-nav">
<div class="card-header">
<h3>Quick Links</h3>
Expand All @@ -11,3 +11,4 @@ <h3>Quick Links</h3>
</ul>
</div>
</nav>
!-->
10 changes: 5 additions & 5 deletions docs/_includes/custom/section-sidebar.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ <h3>Tutorials</h3>
<ul>
<!--<li><a href="{{ site.github.url }}/tutorial-bulk-savechanges">Bulk SaveChanges</a></li>!-->
<li><a href="{{ site.github.url }}/tutorial-bulk-operations">Bulk Operations</a></li>
<li><a href="{{ site.github.url }}/tutorial-batch-operations">Batch Operations</a></li>
<li><a href="{{ site.github.url }}/tutorial-batch-operations">Batch Operations (Coming Soon)</a></li>
</ul>

</div>
Expand All @@ -36,8 +36,8 @@ <h3>Bulk Operations</h3>

<h3>Batch Operations</h3>
<ul>
<li><a href="{{ site.github.url }}/delete-from-query">Delete from Query</a></li>
<li><a href="{{ site.github.url }}/update-from-query">Update from Query</a></li>
<li><a href="{{ site.github.url }}/delete-from-query">Delete from Query (Coming Soon)</a></li>
<li><a href="{{ site.github.url }}/update-from-query">Update from Query (Coming Soon)</a></li>
</ul>

<h3>Options</h3>
Expand Down Expand Up @@ -114,11 +114,11 @@ <h3>License</h3>
<li><a href="{{ site.github.url }}/dbbulkoperationconcurrency-exception">DbBulkOperationConcurrency</a></li>
</ul>!-->

<h3>General</h3>
<!--<h3>General</h3>
<ul>
<li><a href="{{ site.github.url }}/foreign-key-constraint-autodetectchanges-disabled">Foreign Key Constraint</a></li>
<li><a href="{{ site.github.url }}/out-of-memory">Out of Memory</a></li>
</ul>
</ul>!-->

<h3>Type</h3>
<ul>
Expand Down
34 changes: 17 additions & 17 deletions docs/index.md
Original file line number Diff line number Diff line change
Expand Up @@ -219,8 +219,8 @@ context.BulkMerge(customers, options => {

<div class="container">

<!-- Bulk SaveChanges
<h2 class="wow slideInUp"><span class="text-z">Bulk</span> SaveChanges</h2>
<!--Bulk SubmitChanges !-->
<h2 class="wow slideInUp"><span class="text-z">Bulk</span> SubmitChanges (Coming Soon)</h2>
<div class="row">
<div class="col-lg-5 wow slideInLeft">
<p class="feature-tagline">Make your applications 10x to 50x times more <span class="text-z">scalable</span> without any configuration and effort.</p>
Expand All @@ -229,29 +229,29 @@ context.BulkMerge(customers, options => {
<li>Easy to customize</li>
<li>Easy to maintain</li>
</ul>
<div class="more-info">
<a href="{{ site.github.url }}/tutorial-bulk-savechanges" class="btn btn-lg btn-z" role="button">
<!--<div class="more-info">
<a href="{{ site.github.url }}/tutorial-bulk-SubmitChanges" class="btn btn-lg btn-z" role="button">
<i class="fa fa-book"></i>&nbsp;
Read More
</a>
</div>
</a>
</div> !-->
</div>
<div class="col-lg-7 wow slideInRight">
<div class="card card-code card-code-dark">
<div class="card-header"><h5>Bulk SaveChanges Examples</h5></div>
<div class="card-header"><h5>Bulk SubmitChanges Examples</h5></div>
<div class="card-body">
{% highlight csharp %}
// Easy to use
context.BulkSaveChanges();
// Easy to use (Coming Soon)
context.BulkSubmitChanges();

// Easy to customize
context.BulkSaveChanges(options => options.BatchSize = 1000);
// Easy to customize (Coming Soon)
context.BulkSubmitChanges(options => options.BatchSize = 1000);
{% endhighlight %}
</div>
</div>
</div>
</div>
!-->

<hr class="m-y-md" />
<!-- Bulk Operations !-->
Expand Down Expand Up @@ -296,8 +296,8 @@ context.BulkMerge(customers, options => {

<hr class="m-y-md" />

<!-- Batch Operations (Coming Soon!) !-->
<h2 class="wow slideInUp"><span class="text-z">Batch</span> Operations</h2>
<!-- Batch Operations !-->
<h2 class="wow slideInUp"><span class="text-z">Batch</span> Operations (Coming Soon)</h2>
<div class="row">
<div class="col-lg-5 wow slideInLeft">
<p class="feature-tagline">Perform your operations from LINQ Query without loading entities in the context.</p>
Expand All @@ -317,11 +317,11 @@ context.BulkMerge(customers, options => {
<div class="card-header"><h5>Batch Operations Examples</h5></div>
<div class="card-body">
{% highlight csharp %}
// DELETE all inactive customers
// DELETE all inactive customers (Coming Soon)
context.Customers.Where(x => !x.IsActif)
.DeleteFromQuery();

// UPDATE all inactive customers
// UPDATE all inactive customers (Coming Soon)
context.Customers.Where(x => !x.IsActif)
.UpdateFromQuery(x => new Customer {IsActif = true});
{% endhighlight %}
Expand Down Expand Up @@ -401,4 +401,4 @@ We are different

</div>
{% include component-rotator-dark-end.html %}
</div>
</div>
2 changes: 1 addition & 1 deletion docs/pages/api/api.md
Original file line number Diff line number Diff line change
Expand Up @@ -66,4 +66,4 @@ permalink: api
.card-group .card-body li {
padding-top: 5px;
}
</style>
</style>
14 changes: 7 additions & 7 deletions docs/pages/api/bulk-delete.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ context.BulkDelete(customers, options => options.ColumnPrimaryKeyExpression = cu

Despite the `ChangeTracker` being outstanding to track what's modified, it lacks in term of scalability and flexibility.

`SaveChanges` requires one database round-trip for every entity to `delete`. So if you need to `delete` 10000 entities, then 10000 database round-trips will be performed which is **INSANELY** slow.
`SubmitChanges` requires one database round-trip for every entity to `delete`. So if you need to `delete` 10000 entities, then 10000 database round-trips will be performed which is **INSANELY** slow.

`BulkDelete` in counterpart offers great customization and requires the minimum database round-trips as possible.

## Performance Comparisons

| Operations | 1,000 Entities | 2,000 Entities | 5,000 Entities |
| :-------------- | -------------: | -------------: | -------------: |
| SaveChanges | 1,000 ms | 2,000 ms | 5,000 ms |
| SubmitChanges | 1,000 ms | 2,000 ms | 5,000 ms |
| BulkDelete | 45 ms | 50 ms | 60 ms |

{% include section-faq-begin.html %}
Expand Down Expand Up @@ -70,16 +70,16 @@ context.BulkDelete(customers, options => options.ColumnPrimaryKeyExpression = cu
context.BulkDelete(customers, options => options.ColumnPrimaryKeyExpression = customer => new { customer.Code1, customer.Code2 });
{% endhighlight %}

### How can I include child entities (Entity Graph)?
You cannot. Due to the risk of mistakes, we preferred not to offer this option and make sure every entity you wish to `delete` is specified.
<!--### How can I include child entities (Entity Graph)?
You cannot. Due to the risk of mistakes, we preferred not to offer this option and make sure every entity you wish to `delete` is specified.!-->

### Why BulkDelete doesn't use the ChangeTracker?
To provide the best performance possible!

Since using the `ChangeTracker` can greatly reduce performance, we chose to let `BulkSaveChanges` method handle scenarios with `ChangeTracker` and `BulkDelete`, scenarios without it.
Since using the `ChangeTracker` can greatly reduce performance, we chose to let `SubmitChanges` method handle scenarios with `ChangeTracker` and `BulkDelete`, scenarios without it.

### Why BulkDelete is faster than BulkSaveChanges?
The major difference between both methods is `BulkSaveChanges` uses the `ChangeTracker` but not the `BulkDelete` method.
### Why BulkDelete is faster than SubmitChanges?
The major difference between both methods is `SubmitChanges` uses the `ChangeTracker` but not the `BulkDelete` method.

By skipping the `ChangeTracker`, some methods like `DetectChanges` are no longer required which greatly helps to improve the performance.
{% include section-faq-end.html %}
Expand Down
18 changes: 9 additions & 9 deletions docs/pages/api/bulk-insert.md
Original file line number Diff line number Diff line change
Expand Up @@ -19,17 +19,17 @@ context.BulkInsert(list, options => options.BatchSize = 100);
## Purpose
`Inserting` thousand of entities for an initial load or a file importation is a typical scenario.

`SaveChanges` method makes it quite impossible to handle this kind of situation directly from Entity Framework due to the number of database round-trips required.
<!--`SubmitChanges` method makes it quite impossible to handle this kind of situation directly from Entity Framework due to the number of database round-trips required.
`SaveChanges` requires one database round-trip for every entity to `insert`. So if you need to `insert` 10000 entities, then 10000 database round-trips will be performed which is **INSANELY** slow.
!-->`SubmitChanges` requires one database round-trip for every entity to `insert`. So if you need to `insert` 10000 entities, then 10000 database round-trips will be performed which is **INSANELY** slow.!

`BulkInsert` in counterpart requires the minimum database round-trips as possible. By example under the hood for SQL Server, a simple`SqlBulkCopy` could be performed.

## Performance Comparisons

| Operations | 1,000 Entities | 2,000 Entities | 5,000 Entities |
| :-------------- | -------------: | -------------: | -------------: |
| SaveChanges | 1,000 ms | 2,000 ms | 5,000 ms |
| SubmitChanges | 1,000 ms | 2,000 ms | 5,000 ms |
| BulkInsert | 6 ms | 10 ms | 15 ms |

{% include section-faq-begin.html %}
Expand Down Expand Up @@ -66,23 +66,23 @@ Read more: [ColumnInputExpression](/column-input-expression)
context.BulkInsert(list, options => options.ColumnInputExpression = c => new {c.Name, c.Description});
{% endhighlight %}

### How can I include child entities (Entity Graph)?
<!--### How can I include child entities (Entity Graph)?
You can include child entities using the `IncludeGraph` option. Make sure to read about the `IncludeGraph` since this option is not as trivial as others.
Read more: [IncludeGraph](/include-graph)
Read more: [IncludeGraph](/include-graph)
{% include template-example.html %}
{% highlight csharp %}
context.BulkInsert(list, options => options.IncludeGraph = true);
{% endhighlight %}
{% endhighlight %} !-->

### Why BulkInsert doesn't use the ChangeTracker?
To provide the best performance possible!

Since using the `ChangeTracker` can greatly reduce performance, we chose to let `BulkSaveChanges` method handle the scenarios with `ChangeTracker` and `BulkInsert` the scenarios without it.
Since using the `ChangeTracker` can greatly reduce performance, we chose to let `SubmitChanges` method handle the scenarios with `ChangeTracker` and `BulkInsert` the scenarios without it.

### Why BulkInsert is faster than BulkSaveChanges?
The major difference between both methods is `BulkSaveChanges` uses the `ChangeTracker` but not the `BulkInsert` method.
### Why BulkInsert is faster than SubmitChanges?
The major difference between both methods is `SubmitChanges` uses the `ChangeTracker` but not the `BulkInsert` method.

By skipping the `ChangeTracker`, some methods like `Add`, `AddRange`, `DetectChanges` are no longer required which greatly helps to improve the performance.
{% include section-faq-end.html %}
Expand Down
10 changes: 5 additions & 5 deletions docs/pages/api/bulk-merge.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ context.BulkMerge(customers, options => options.ColumnPrimaryKeyExpression = cus

Despite the `ChangeTracker` being outstanding to track what's modified, it lacks in term of scalability and flexibility.

`SaveChanges` requires one database round-trip for every entity to `insert` or `update`. So if you need to `insert` or `update` 10000 entities, then 10000 database round-trips will be performed which is **INSANELY** slow.
`SubmitChanges` requires one database round-trip for every entity to `insert` or `update`. So if you need to `insert` or `update` 10000 entities, then 10000 database round-trips will be performed which is **INSANELY** slow.

`BulkMerge` in counterpart offers great customization and requires the minimum database round-trips as possible.

## Performance Comparisons

| Operations | 1,000 Entities | 2,000 Entities | 5,000 Entities |
| :-------------- | -------------: | -------------: | -------------: |
| SaveChanges | 1,000 ms | 2,000 ms | 5,000 ms |
| SubmitChanges | 1,000 ms | 2,000 ms | 5,000 ms |
| BulkMerge | 65 ms | 80 ms | 110 ms |

{% include section-faq-begin.html %}
Expand Down Expand Up @@ -96,20 +96,20 @@ context.BulkMerge(customers, options => options.ColumnPrimaryKeyExpression = cus
context.BulkMerge(customers, options => options.ColumnPrimaryKeyExpression = customer => new { customer.Code1, customer.Code2 });
{% endhighlight %}

### How can I include child entities (Entity Graph)?
<!--### How can I include child entities (Entity Graph)?
You can include child entities using the `IncludeGraph` option. Make sure to read about the `IncludeGraph` since this option is not as trivial as others.
Read more: [IncludeGraph](/include-graph)
{% include template-example.html %}
{% highlight csharp %}
context.BulkMerge(list, options => options.IncludeGraph = true);
{% endhighlight %}
{% endhighlight %}!-->

### Why BulkMerge doesn't use the ChangeTracker?
To provide the best performance possible!

Since using the `ChangeTracker` can greatly reduce performance, we chose to let `BulkSaveChanges` method handle scenarios with `ChangeTracker` and `BulkMerge`, scenarios without it.
Since using the `ChangeTracker` can greatly reduce performance, we chose to let `SubmitChanges` method handle scenarios with `ChangeTracker` and `BulkMerge`, scenarios without it.
{% include section-faq-end.html %}

## Related Articles
Expand Down
4 changes: 2 additions & 2 deletions docs/pages/api/bulk-synchronize.md
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ context.BulkSynchronize(customers, options => options.ColumnPrimaryKeyExpression

| Operations | 1,000 Entities | 2,000 Entities | 5,000 Entities |
| :-------------- | -------------: | -------------: | -------------: |
| SaveChanges | 1,000 ms | 2,000 ms | 5,000 ms |
| SubmitChanges | 1,000 ms | 2,000 ms | 5,000 ms |
| BulkSynchronize | 55 ms | 65 ms | 85 ms |

{% include section-faq-begin.html %}
Expand Down Expand Up @@ -82,4 +82,4 @@ context.BulkSynchronize(customers, options => options.ColumnPrimaryKeyExpression
## Related Articles
- [How to Benchmark?](benchmark)
- [How to use Custom Column?](custom-column)
- [How to use Custom Key?](custom-key)
- [How to use Custom Key?](custom-key)
16 changes: 8 additions & 8 deletions docs/pages/api/bulk-update.md
Original file line number Diff line number Diff line change
Expand Up @@ -21,15 +21,15 @@ context.BulkUpdate(customers, options => options.ColumnPrimaryKeyExpression = cu

Despite the `ChangeTracker` being outstanding to track what's modified, it lacks in term of scalability and flexibility.

`SaveChanges` requires one database round-trip for every entity to `update`. So if you need to `update` 10000 entities, then 10000 database round-trips will be performed which is **INSANELY** slow.
`SubmitChanges` requires one database round-trip for every entity to `update`. So if you need to `update` 10000 entities, then 10000 database round-trips will be performed which is **INSANELY** slow.

`BulkUpdate` in counterpart offers great customization and requires the minimum database round-trips possible.

## Performance Comparisons

| Operations | 1,000 Entities | 2,000 Entities | 5,000 Entities |
| :-------------- | -------------: | -------------: | -------------: |
| SaveChanges | 1,000 ms | 2,000 ms | 5,000 ms |
| SubmitChanges | 1,000 ms | 2,000 ms | 5,000 ms |
| BulkUpdate | 50 ms | 55 ms | 65 ms |

{% include section-faq-begin.html %}
Expand Down Expand Up @@ -80,23 +80,23 @@ context.BulkUpdate(customers, options => options.ColumnPrimaryKeyExpression = cu
context.BulkUpdate(customers, options => options.ColumnPrimaryKeyExpression = customer => new { customer.Code1, customer.Code2 });
{% endhighlight %}

### How can I include child entities (Entity Graph)?
<!--### How can I include child entities (Entity Graph)?
You can include child entities using the `IncludeGraph` option. Make sure to read about the `IncludeGraph` since this option is not as trivial as others.
Read more: [IncludeGraph](/include-graph)
Read more: [IncludeGraph](/include-graph)!
{% include template-example.html %}
{% highlight csharp %}
context.BulkUpdate(list, options => options.IncludeGraph = true);
{% endhighlight %}
{% endhighlight %}-->

### Why BulkUpdate doesn't use the ChangeTracker?
To provide the best performance possible!

Since using the `ChangeTracker` can greatly reduce performance, we chose to let `BulkSaveChanges` method handle scenarios with `ChangeTracker` and `BulkUpdate`, scenarios without it.
Since using the `ChangeTracker` can greatly reduce performance, we chose to let `SubmitChanges` method handle scenarios with `ChangeTracker` and `BulkUpdate`, scenarios without it.

### Why BulkUpdate is faster than BulkSaveChanges?
The major difference between both methods is `BulkSaveChanges` uses the `ChangeTracker` but not the `BulkUpdate` method.
### Why BulkUpdate is faster than SubmitChanges?
The major difference between both methods is `SubmitChanges` uses the `ChangeTracker` but not the `BulkUpdate` method.

By skipping the `ChangeTracker`, some methods like `DetectChanges` are no longer required which greatly helps to improve the performance.
{% include section-faq-end.html %}
Expand Down
8 changes: 4 additions & 4 deletions docs/pages/api/delete-from-query.md
Original file line number Diff line number Diff line change
Expand Up @@ -17,23 +17,23 @@ context.Customers.Where(x => x.ID == userId).DeleteFromQuery();
{% endhighlight %}

## Purpose
`Deleting` entities using `SaveChanges` normally requires to load them first in the `ChangeTracker`. These additional round-trips are often not necessary.
`Deleting` entities using `SubmitChanges` normally requires to load them first in the `ChangeTracker`. These additional round-trips are often not necessary.

`DeleteFromQuery` gives you access to directly execute a `DELETE` statement in the database and provide a **HUGE** performance improvement.

## Performance Comparisons

| Operations | 1,000 Entities | 2,000 Entities | 5,000 Entities |
| :-------------- | -------------: | -------------: | -------------: |
| SaveChanges | 1,000 ms | 2,000 ms | 5,000 ms |
| SubmitChanges | 1,000 ms | 2,000 ms | 5,000 ms |
| DeleteFromQuery | 1 ms | 1 ms | 1 ms |

{% include section-faq-begin.html %}
## FAQ

### Why DeleteFromQuery is faster than SaveChanges, BulkSaveChanges, and BulkDelete?
### Why DeleteFromQuery is faster than SubmitChanges, BulkSubmitChanges, and BulkDelete?

`DeleteFromQuery` executes a statement directly in SQL such as `DELETE FROM [TableName] WHERE [Key]`.

Other operations normally require one or multiple database round-trips which makes the performance slower.
{% include section-faq-end.html %}
{% include section-faq-end.html %}
6 changes: 3 additions & 3 deletions docs/pages/api/options-summary/options-audit.md
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ Gets or sets if `INSERTED` and `DELETED` data from the database should be return
{% highlight csharp %}
List<AuditEntry> auditEntries = new List<AuditEntry>();

context.BulkSaveChanges(options =>
context.BulkSubmitChanges(options =>
{
options.UseAudit = true;
options.BulkOperationExecuted = bulkOperation => auditEntries.AddRange(bulkOperation.AuditEntries);
Expand All @@ -26,7 +26,7 @@ Gets `INSERTED` and `DELETED` data when `UseAudit` option is enabled.
{% highlight csharp %}
List<AuditEntry> auditEntries = new List<AuditEntry>();

context.BulkSaveChanges(options =>
context.BulkSubmitChanges(options =>
{
options.UseAudit = true;
options.BulkOperationExecuted = bulkOperation => auditEntries.AddRange(bulkOperation.AuditEntries);
Expand All @@ -40,4 +40,4 @@ foreach (var entry in auditEntries)
var newValue = value.NewValue;
}
}
{% endhighlight %}
{% endhighlight %}
Loading

0 comments on commit ea70846

Please sign in to comment.