abp icon indicating copy to clipboard operation
abp copied to clipboard

ConnectionString Issue

Open erapote opened this issue 1 year ago • 5 comments

Is there an existing issue for this?

  • [X] I have searched the existing issues

Description

ABP studio accepts only a single backslash ("") when you are assigning a connection string (SQL server). This produces problem since in appsettings.json, the connection string should have double backslash ("\").

abp-bug-3 abp-bug-2 abp-bug-1

Version

Community edition v0.9.21

Operation System

Windows (Default)

Solution Configuration

No response

Other information

No response

erapote avatar Jan 10 '25 13:01 erapote

When you define the connection string it directly tries to connect to the database with the specified connection string. However, in your code, it should be as double backslash, because one of them acts as an escape character (). This is not related to ABP Studio, if you would create a normal application and try to define it without double backslash, you would still get the same problem.

EngincanV avatar Jan 10 '25 13:01 EngincanV

Hello, I don't think you understand the issue. The issue is that the studio does not accept the connection string with double backslash and when you continue with the migration there, it produces an error. Sure we can always replace connection strings in the code or appsettings.json. But the point is, this is a studio and generation bug which does not happen before.

With the previous version of studio, and when you first generate a solution there, it assigns a localDB connection string which has a double backslash. Now when you proceed with that, it now produces an error that I have attached (see screen shots). You have to replace the double backslash to a single one inorder to proceed. But in the end when it is already running migration, it throws that error since it uses an invalid connection string with a single backslash that C# does not accept.

See the difference below:

abp-bug-4

abp-bug-1

erapote avatar Jan 10 '25 13:01 erapote

Hello, I don't think you understand the issue. The issue is that the studio does not accept the connection string with double backslash and when you continue with the migration there, it produces an error. Sure we can always replace connection strings in the code or appsettings.json. But the point is, this is a studio and generation bug which does not happen before.

With the previous version of studio, and when you first generate a solution there, it assigns a localDB connection string which has a double backslash. Now when you proceed with that, it now produces an error that I have attached (see screen shots). You have to replace the double backslash to a single one inorder to proceed. But in the end when it is already running migration, it throws that error since it uses an invalid connection string with a single backslash that C# does not accept.

Sorry, It seems I misunderstood. When you define \\ with localdb, we're replacing the double backsplash for checking the related server, however, we did not do this for other servers. I'll create an internal issue for that.

EngincanV avatar Jan 10 '25 13:01 EngincanV

Okay, thank you. :)

erapote avatar Jan 10 '25 13:01 erapote

Created the issue in our internal repository (with tracking-number 2572), and it will be fixed with the next ABP Studio release. Thanks for reporting this problem.

EngincanV avatar Jan 10 '25 13:01 EngincanV