how to use sqlServer in Sample19?
See original GitHub issueI want to use sqlServer in Sample19,So I change the appsettings.json:
“ConnectionStrings”: {
“SqlServer”: “Data Source=.;Integrated Security=SSPI;Initial Catalog=MyTest;”
},
and in the fold of Sample19 ,I run the cmd as :
SET EF_CONNECTIONSTRING=“Data Source=.;Integrated Security=SSPI;Initial Catalog=MyTest;”
dotnet ef database update --context ElsaContext
and I got the wrong msg:
System.ArgumentException: Keyword not supported: ‘"data source’.
at Microsoft.Data.Common.DbConnectionOptions.ParseInternal(Dictionary2 parsetable, String connectionString, Boolean buildChain, Dictionary
2 synonyms, Boolean firstKey)
at Microsoft.Data.Common.DbConnectionOptions…ctor(String connectionString, Dictionary2 synonyms) at Microsoft.Data.SqlClient.SqlConnectionString..ctor(String connectionString) at Microsoft.Data.SqlClient.SqlConnectionFactory.CreateConnectionOptions(String connectionString, DbConnectionOptions previous) at Microsoft.Data.ProviderBase.DbConnectionFactory.GetConnectionPoolGroup(DbConnectionPoolKey key, DbConnectionPoolGroupOptions poolOptions, DbConnectionOptions& userConnectionOptions) at Microsoft.Data.SqlClient.SqlConnection.ConnectionString_Set(DbConnectionPoolKey key) at Microsoft.Data.SqlClient.SqlConnection.set_ConnectionString(String value) at Microsoft.Data.SqlClient.SqlConnection..ctor(String connectionString) at Microsoft.EntityFrameworkCore.SqlServer.Storage.Internal.SqlServerConnection.CreateDbConnection() at Microsoft.EntityFrameworkCore.Storage.RelationalConnection.get_DbConnection() at Microsoft.EntityFrameworkCore.Diagnostics.RelationalLoggerExtensions.MigrateUsingConnection(IDiagnosticsLogger
1 diagnostics, IMigrator migrator, IRelationalConnection connection)
at Microsoft.EntityFrameworkCore.Migrations.Internal.Migrator.Migrate(String targetMigration)
at Microsoft.EntityFrameworkCore.Design.Internal.MigrationsOperations.UpdateDatabase(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabaseImpl(String targetMigration, String contextType)
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.UpdateDatabase.<>c__DisplayClass0_0.<.ctor>b__0()
at Microsoft.EntityFrameworkCore.Design.OperationExecutor.OperationBase.Execute(Action action)
Keyword not supported: ‘"data source’.
so ,How to use sqlServer in the example? thanks
Issue Analytics
- State:
- Created 4 years ago
- Comments:19 (7 by maintainers)
Top GitHub Comments
please add a sqlServer example,thank!
Hi guys, for all lonely souls building the ef core migration using vscode and powershell instead of cmd: You need to interchange the
SET EF_CONNECTIONSTRING
command with$env:EF_CONNECTIONSTRING="Server=localhost;Database=Elsa;User=sa;Password=Secret_password123!;"