Pitfalls of EF
EF abstracts a lot of details from you, significantly simplifying your work. However, it also introduces the risk of not being aware of what is actually happening. Sometimes, you might achieve what you want, but there may be a chance that you are not optimally achieving your goal. The following are some of the most common mistakes made in EF.
Examples Setup
For all the following examples, assume that you will have this line initialized at the start:
var db = new GlobalFactory2021Context();
Assume, too, that every example will finish with this:
db.Dispose();
Also, the data itself will be seeded (pre-generated) using the following code:
DataSeeding.cs
public static class DataSeeding { Â Â Â Â public const string ManufacturerName = "Test Factory"; Â Â Â Â public const string TestProduct1Name = "Product1Â Â Â Â "; Â Â Â Â /// <summary> Â Â Â ...