I want to implement a new WebApp in an existing MySQL database, the problem appears when I try to do the migration or the connection because I have already an 'Users' table in there, so I want to create my own tables (webapp_users, webapp_roles, ...).
I tried several ways to do it but no one worked, Can you help me and tell me the steps to follow to do this from the 'New > Project...' step?
Should I install the MySQL packages from the NuGet Package Manager, use external tools/addons, ...?
I will appreciate that, I'm completely blocked.
Create a db in your MySql server with the required tables and follow these steps :
- Import
MySql.Web
,MySql.Data
andMySql.Data.Entity.EF6
dlls into your project first.- Now create a Entity framework data model from your database by right clicking any folder -> new item -> Data -> ADO.net entity data model
- Click Generate from database -> Next
- Click on New Connection -> Change ->
- Select MySql Database as datasource
- Give your MySql server credentials and select database to generate the data model from database
It should work fine.
Edit : You can also pass the name of the connection string (stored in the web.config) in your context to the base constructor of the IdentityDbContext
public class MyDbContext : IdentityDbContext<MyUser>
{
public MyDbContext()
: base("TheNameOfTheConnectionString")
{
}
}