简体   繁体   中英

Use MySQL instead of LocalDb

I'm trying to use the default authentication system for a Web API 2 and I noticed it creates the following database :

在此处输入图片说明

but I have already an Entity database with MySQL. Is it possible to merge them?

Then I could add the context to the startup options like that

UserManagerFactory = () => new UserManager<IdentityUser>(new UserStore<IdentityUser>(MYCONTEXT));

Would it work?

Because I don't know how to use 2 databases with Entity. The authentication doesn't work since I replaced the EntityFramework section in the Web Config for this one

<entityFramework codeConfigurationType="MySql.Data.Entity.MySqlEFConfiguration, MySql.Data.Entity.EF6">
    <defaultConnectionFactory type="System.Data.Entity.Infrastructure.SqlConnectionFactory, EntityFramework" />
    <providers>
      <provider invariantName="MySql.Data.MySqlClient" type="MySql.Data.MySqlClient.MySqlProviderServices, MySql.Data.Entity.EF6" />
    </providers>
  </entityFramework>

So is it possible to use a database first approach with the AspNet tables.

Thank you

EDIT

Would it be more easy to use SQL server because it's still possible to use it for this project?

I just want to refer you to this link as solution:

Entity Framework Model from two databases

But I still think a redesign of schema using one database will be better.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM