diff --git a/package-lock.json b/package-lock.json index 21ba4566..aee72fc0 100644 --- a/package-lock.json +++ b/package-lock.json @@ -16149,7 +16149,7 @@ }, "plugins/dotnet-db-sqlserver": { "name": "@amplication/plugin-dotnet-db-sqlserver", - "version": "0.0.1", + "version": "0.0.3", "license": "Apache-2.0", "devDependencies": { "@amplication/code-gen-types": "2.0.33-beta.9", diff --git a/plugins/dotnet-db-sqlserver/package.json b/plugins/dotnet-db-sqlserver/package.json index b09ec5fe..afaf7860 100644 --- a/plugins/dotnet-db-sqlserver/package.json +++ b/plugins/dotnet-db-sqlserver/package.json @@ -1,6 +1,6 @@ { "name": "@amplication/plugin-dotnet-db-sqlserver", - "version": "0.0.1", + "version": "0.0.3", "description": "Use an MS SQL Server database in a service generated by Amplication", "main": "dist/index.js", "nx": {}, diff --git a/plugins/dotnet-db-sqlserver/src/constants.ts b/plugins/dotnet-db-sqlserver/src/constants.ts index 4e8872f7..0db762b2 100644 --- a/plugins/dotnet-db-sqlserver/src/constants.ts +++ b/plugins/dotnet-db-sqlserver/src/constants.ts @@ -11,7 +11,7 @@ export const updateDockerComposeProperties = ( services: { server: { environment: { - ConnectionStrings__DbContext: `sqlserver://db:1433;database=${dbName};user=${user};password=${password};TrustServerCertificate=true`, + ConnectionStrings__DbContext: `Data Source=db,1433;Initial Catalog=${dbName};User Id=${user};Password=${password};TrustServerCertificate=true;`, }, depends_on: { migrate: { @@ -21,7 +21,7 @@ export const updateDockerComposeProperties = ( }, migrate: { environment: { - MIGRATION_CONNECTION: `sqlserver://db:1433;database=${dbName};user=${user};password=${password};TrustServerCertificate=true`, + MIGRATION_CONNECTION: `Data Source=db,1433;Initial Catalog=${dbName};User Id=${user};Password=${password};TrustServerCertificate=true;`, }, }, db: { diff --git a/plugins/dotnet-db-sqlserver/src/index.ts b/plugins/dotnet-db-sqlserver/src/index.ts index ef6baeb1..2b77d5fa 100644 --- a/plugins/dotnet-db-sqlserver/src/index.ts +++ b/plugins/dotnet-db-sqlserver/src/index.ts @@ -63,7 +63,7 @@ class MSSQLServerPlugin implements dotnetTypes.AmplicationPlugin { eventParams.updateProperties = { ...eventParams.updateProperties, ConnectionStrings: { - [CONNECTION_STRING]: `sqlserver://${host}:${port};database=${dbName};user=${user};password=${password};TrustServerCertificate=true`, + [CONNECTION_STRING]: `Data Source=${host},${port};Initial Catalog=${dbName};User Id=${user};Password=${password};TrustServerCertificate=true;`, }, }; return eventParams; @@ -78,7 +78,7 @@ class MSSQLServerPlugin implements dotnetTypes.AmplicationPlugin { eventParams.builderServicesBlocks.push( new CodeBlock({ - code: `builder.services.AddDbContext<${serviceDbContext}>(opt => opt.UseSqlServer(builder.Configuration.GetConnectionString("${CONNECTION_STRING}")));`, + code: `builder.Services.AddDbContext<${serviceDbContext}>(opt => opt.UseSqlServer(builder.Configuration.GetConnectionString("${CONNECTION_STRING}")));`, references: [ new ClassReference({ name: "AddDbContext",