AspNet MVC database first or code first

4

I have an AspNet MVC 5 project in which I will use Owin and identity, I needed to customize identity (attributes and relations) to meet my needs, however I already have all the "ready" bank tables ), in these already existing tables I'll create relationships for my AspNetUsers identity table. So this is the problem, is this wrong? What are the problems in doing this? I feel like I'm mixing databasefirst with codefirst and in fact I do not know if that's right or wrong, what problems can arise from having to fiddle with the fist code of identiy classes? What are the problems when moving the columns of my database already created via databasefirst?

    
asked by anonymous 11.08.2016 / 14:53

1 answer

2
  

So, is the problem wrong?

No. Identity is designed to work with an almost complete level of customization. Not only is it possible to define more User relationships with other entities such as until you change the name of the table in the database.

  

What are the problems with doing this?

As far as I know, it's okay to relate users to other entities on your system.

  

I feel like I'm mixing databasefirst with codefirst and in fact I do not know if this is right or wrong, what problems can arise from having to fiddle with the fist code of identiy classes?

If I understand, you seem to want to take advantage of a database that already exists with ASP.NET Identity. Then I would say it can be problematic. I explain:

ASP.NET Identity implements some features that your existing database will hardly have, such as handling passwords. Unless your bank has exactly the same information, it would work without problems, which is very difficult because other frameworks do not implement the same encryption scheme .

In this case, it is better to implement your own scheme and not use Identity.

  

What are the problems when moving the columns of my database already created via databasefirst?

It depends on several factors. A legacy system could stop working, for example.

For databases that already exist, it is not recommended to let the Entity Framework manage the database. Database First does not manage the database by design .

    
11.08.2016 / 17:01