0

I am trying to connect to SQL Server in a .NET Core 3 library, for implementation this ORM I use "Database First Scaffold-DbContext" command like this:

Scaffold-DbContext "Server=IP/sql2016;Initial Catalog=DatabaseName;
    Persist Security Info=True; User ID=UserName; Password=Password; 
    MultipleActiveResultSets=False; Encrypt=True; TrustServerCertificate=True; 
    Connection Timeout=30;" Microsoft.EntityFrameworkCore.SqlServer -OutputDir 
    Models -Force

If I use this command with IP server, it just creates DbContext and does not create table models. If I replace the server IP with local (when restore database backup to my local database) it creates all data models.

I don't know what should I do?

Another question: when I create a data model, does it not assign primary key to my model?

1 Answer 1

1

My database user was not db owner so it can't create models.

Sign up to request clarification or add additional context in comments.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.