Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Add Table Later to Database First Project

$
0
0

Hello 

I have a project with Database First Migration 

I used the below code from PM to scaffold the DB 

Scaffold-DbContext "Server=(localdb)\mssqllocaldb;Database=Blogging;Trusted_Connection=True;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir Models

now I want to create a table, I tried to add it as New model class but when I do the command 

add-migration -context mycontext 

It is not adding it to migration file

1- Do I have to add it to Snapshot file? I added it but when I process add-migration command, it is removed from Snapshot 

2- Can I create the table in SQL and then scaffold it again, only for the new table.

 

Any Idea? 


Viewing all articles
Browse latest Browse all 9386

Trending Articles



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