Skip to content

Commit a9b72b5

Browse files
author
zzzprojects
committed
Add news articles
Add news articles
1 parent e33b477 commit a9b72b5

File tree

4 files changed

+78
-1
lines changed

4 files changed

+78
-1
lines changed

docs/_data/meta.csv

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -87,3 +87,5 @@ soft-delete,soft-delete,soft-delete,soft-delete,Soft Delete,,,no,container-doc,s
8787
bulk-insert-vs-bulk-savechanges,BulkInsert vs BulkSaveChanges,BulkInsert vs BulkSaveChanges,,BulkInsert vs BulkSaveChanges,,,no,container-doc,section-article
8888
articles,Articles,Articles,,Articles,,,no,container-doc,section-article
8989
trial,Trial,Trial,,Trial,,,no,container-doc,section-article
90+
edmx,Edmx,Edmx,,Edmx,,,no,container-doc,section-article
91+
out-of-memory,Out of memory,Out of memory,,Out of memory,,,no,container-doc,section-article

docs/_includes/custom/section-sidebar.html

Lines changed: 5 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -77,7 +77,10 @@ <h3>Customizations</h3>
7777
<li><a href="{{ site.github.url }}/soft-delete">Soft Delete</a></li>
7878
<li><a href="{{ site.github.url }}/concurrency">Concurrency</a></li>
7979
</ul>
80-
80+
<h3>Misc</h3>
81+
<ul>
82+
<li><a href="{{ site.github.url }}/edmx">Edmx</a></li>
83+
</ul>
8184
</div>
8285
</nav>
8386

@@ -114,6 +117,7 @@ <h3>Concurrency</h3>
114117
<h3>General</h3>
115118
<ul>
116119
<li><a href="{{ site.github.url }}/foreign-key-constraint-autodetectchanges-disabled">Foreign Key Constraint</a></li>
120+
<li><a href="{{ site.github.url }}/out-of-memory">Out of Memory</a></li>
117121
</ul>
118122

119123
<h3>Type</h3>

docs/pages/articles/emdx.md

Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
---
2+
permalink: edmx
3+
---
4+
5+
In a rare occasion, your model might not still compatible yet with our model reader. If that's your case and we ask you for your model, you can use one of the following methods to provide the required information:
6+
7+
## Code First
8+
Use the `GetModelXDocument` method to generate the Edmx to send.
9+
10+
{% include template-example.html %}
11+
{% highlight csharp %}
12+
public string GetModelXDocument(DbContext context)
13+
{
14+
XDocument doc;
15+
using (var memoryStream = new MemoryStream())
16+
{
17+
using (XmlWriter xmlWriter = XmlWriter.Create(memoryStream, new XmlWriterSettings { Indent = true }))
18+
{
19+
EdmxWriter.WriteEdmx(context, xmlWriter);
20+
}
21+
22+
memoryStream.Position = 0;
23+
24+
doc = XDocument.Load(memoryStream);
25+
}
26+
return doc.ToString();
27+
}
28+
29+
DbContext context = new EntityContext();
30+
string edmx = GetModelXDocument();
31+
{% endhighlight %}
32+
33+
34+
## Database First
35+
Provide us the [fileName].edmx directly.
Lines changed: 36 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,36 @@
1+
---
2+
permalink: out-of-memory
3+
---
4+
5+
## Problem
6+
7+
You execute a method from the Entity Framework Extensions library, and the following error is thrown:
8+
9+
{% include template-exception.html message='An exception of type `System.OutOfMemoryException` occured in...' %}
10+
11+
## Cause
12+
That error is caused when the library consumes too much memory.
13+
14+
Most of the time, this error is caused by some methods used from `Entity Framework` for command generations that will be used later by our library.
15+
16+
### Fix
17+
Turning off Entity Framework Propagation
18+
19+
This solution work with around 99% of model. By turning off this options, our library doesn’t longer use several methods from Entity Framework that consume high memory such as the command generations.
20+
21+
See: <a href="/improve-bulk-savechanges">Improve BulkSaveChanges</a>
22+
23+
### Bulk Operations
24+
In some exceptional scenario, using Bulk Operations such as:
25+
26+
- BulkInsert
27+
- BulkUpdate
28+
- BulkDelete
29+
- BulkMerge
30+
31+
might may a better idea. They are faster and consume way less memory than BulkSaveChanges.
32+
33+
### Reduce the number of entities in the ChangeTracker
34+
Another way is to make sure the ChangeTracker doesn’t contain too many entities.
35+
36+
The ChangeTracker has not been build to support millions entities.

0 commit comments

Comments
 (0)