Click here to Skip to main content
15,867,756 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
See more:
I am new to asp.net mvc. I would like to use EF code first approach.I need 3 different database in my project. What I understood from internet till yet

1: That means need to create 3 diff connectionstring in my config file.Appropriate 3 diff context class will be there (project).If context class and connectionstring name is different,need to mention in it's constructor with the help of base keyword. Each context class have proprties as all table of that database.When I build the project, context class will create database with name mention in connectionstring along with all dbcontext property in that database as table if not already exist.

2: If I want to add new table in my database,here I am using EF code first approach So I need to create a class for that and mention it in it's appropriate dbcontext class only and build project. 
Enable migration 
Add Migration 
Update database

This will add table to my database and migration file in project which has up and down method.

Is this a right approach to do.I want to update only perticular databse not all. Shall I write name of database while migrating


What I have tried:

Enable migration 
Add Migration 
Update database
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900