Is it possible to mix code-first and database-first approaches in one project? When modifying the EDMX file, we are seeing severe performance issues throughout development (it takes 1.5 minutes to save). Our non-insert/update/delete UDFs and stored procs have been transferred to some unique T4 templates that spawn model-first code automatically, but I still can't seem to make them to work.
whenever EDMX is involved, to be called.
Other options that we thought about but ultimately decided upon include:
Our entity connections have a lot of overlap, thus we can't (fairly) split our code for different circumstances. Many of the individuals who have chosen this path seem to have changed their minds.
Although we attempted to use two distinct contexts, there are several joins between Entities & UDFs. Even though that could be our final option, I'd rather want to avoid it.
Dapper is not an option for us since we have, regrettably, used it extensively.
Although we made an effort to switch entirely to Code-First, several of the EDMX capabilities we use—most notably the insert/update/delete stored procedure mapping—are not supported.
Visit the following website to learn more. I provided a similar response to another question:
How to implement the repository pattern using the entity framework's database first approach
As I said in that piece, I would personally attempt to abandon the EDMX files in favour of a Code First approach since they are already deprecated and, more significantly, because maintaining them requires a significant amount of work and is much more difficult than with a Code First strategy.
Changing from a Model First approach to a Code First one is not that difficult. Steps and pictures are provided below:
I've done this a few times before, and every time it produced excellent results. Search for tools that can do this conversion for you as well.
You may want to use this chance to reconsider the architecture as well.
By the way, you shouldn't allow bullet point 4 stop you. Using EF, you may map and utilise stored procedures. Visit the pursuing link:
How can I use Entity Framework 6's Code-First method to invoke a stored procedure?