Search code examples
sqlmodel-view-controllerasp.net-coreasp.net-identityscaffolding

Scaffolding Identity framework mvc core


I'm having trouble to recreate my C# project on a virtual machine.

Basically, I've copied my project, opened it on my virtual machine. Scaffolded so I get the SQL database to talk to my project on the virtual machine after I manually created some tables in SQL.

PROBLEM: How do I get the Identity framework sql data-Tables into my virtual machien SQL tables section? I would like the tables highlited in yellow on the left (my original machine sql) to also be present on my virtual machine sql, the right side of the picture.

How can I get this automatically? Nuget for identity framework is downloaded but I guess there is some sort of scaffolding or similar?

Picture of what I mean


Solution

  • If I understand you correctly you want to create tables for Identity. You have 2 options here:

    1. Use Migrations like described in this post

    2. Or just generate SQL scripts for Identity tables using EF Core or SQL Management Studio, since you have SQL Management Studio according to you screen you can use it to generate Script for particular tables using Task->Generate Scripts... while right click on your Database.

    enter image description here

    And then just choose the tables you need and then choose Save to new query window. enter image description here

    1. If database not very huge, you can also use Task->Back up... save it on your machine. Then copy this backup to virtual machine and restore it there using Restore Database. You can even just use SQL for this like described here.