Tidbits of Entity Framework
- EF has been evolving. Mixing data models created with different versions of EF may lead to strange compiling errors.
- Database first approach is usually far suprior to code first approach in terms of performance.
- When using the wizard to create a model, if connection string is not saved, the auto-generated partial class in *.context.cs will be Entities, not MyModelEntities.
- Use Context.CommandTimeout to deal with timeout issues.
- When inserting a large number of records, the key is detach each record after insertion. Otherwise, Context.SaveChange() will take take more and more time.