Dear
Its there someone experience how use Microsoft Entity Framework Core in Wisej (i am using wisej 4).
When i run command “Scaffold-DbContext ‘Name=cmisconString’ Microsoft.EntityFrameworkCore.SqlServer”
there error “A named connection string was used, but the name ‘cmisconString’ was not found in the application’s configuration.”
Based Microsoft tutorial , “cmisconString” (connection string) must put in file “appSettings.json” (there no this file in wisej ). Which file configuration in wisej than support microsoft entity framework core ??.
This what i had to do: (connectionvalue = “Data Source=localhost;Initial Catalog=cmis;User ID=cmis;Password=cmis;Encrypt=False;Trust Server Certificate=True;”)
<ConnectionStrings> <add key=”cmisconString” value=”connectionvalue”/></ConnectionStrings>
“cmisconString” : “connectionvalue”
“ConnectionStrings”: {
“cmisconString”: “connectionvalue”
}
in this way i am successfull running command “Scaffold-DbContext “, but when i want call model in DbContext, there appear the same error.
There no problem when i using an connection without connectionstring alias.
Thanks
Nicky
Hi Nicky,
You can use the appSettings.json approach like you mentioned above, however if you’re running into issues with running queries on the DBContext, then it could be an issue of how you’re injecting the service into the Service Container.
I recommend heading to our documentation about Dependency Injection.
Can you wrap a small runnable sample that would showcase the issue?
Best Regards,
Alaa
Please login first to submit.