Quantcast
Channel: ADO.NET, Entity Framework, LINQ to SQL, NHibernate
Viewing all articles
Browse latest Browse all 1698

Using Code First for database that already has database first approach used in the application

$
0
0

Hi, I am new to the "code first" approach as i have been using database first untill now. 

I have been working on a project with a couple of my friends using .net MVC. We have all been using database first, and created quite large EDMX structure, which at this point is very complex, and to be honest every single update requires quite the effort. 

That is why, when i started to work on one of the sub-modules i wanted to try something else, and the code first seemed like a good way to go.

I have create a new connection string that points to the same database, . My issue is that, when i try to use models that are already used in the db first, i face an error that this class already exists. So i have attpemted to change the name of my code first models with some prefix CF_tablename for example. I have pointed those classes to the proper table name like" [Table("tablename")] " And it seemed to work. However when i try to add a migration now, code first see this as i am attempting to rename those tables...

So my question is, is it ok to use both code first approach and database approach when pointing to the same database ? How can i avoid trying to rename the table name.And do you know of any paid or free courses that gives comperhensive knowlage about Code first approach, not just guide for how to use it with clean application and new database ?


Viewing all articles
Browse latest Browse all 1698

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>