ErikEJ / EFCorePowerTools

Entity Framework Core Power Tools - reverse engineering, migrations and model visualization in Visual Studio & CLI
MIT License
2.19k stars 298 forks source link

Errors every time when connecting to localDB in a code first VS2020 blazor web app project. #2447

Closed DrHoneyBear closed 3 months ago

DrHoneyBear commented 3 months ago

Create a bug report, feature proposal, or ask a question.

NOTICE: A bug report without sufficient technical and repro details and version information WILL BE CLOSED WITHOUT ANY FURTHER ACTION.

Create an empty VS Blazor web app project.

Create a data class, anything will do.

In VS in the Project, right click Add -> New Scaffolded Item. Select Razor Component using Entity Framework (CRUD). Click Add.

For Template keep CRUD. Select the model class you created. Create a new DbContext Class. Click Add.

A (localdb)\mssqllocaldb instance is created. In my case under C:\Users\daz.smith\AppData\Local\Microsoft\Microsoft SQL Server Local DB\Instances\mssqllocaldb

Run the app. Test data can be added and viewed , and persists.

All good. Basic stuff.

Now try to connect to that db instance in EF Core Power Tools. Whatever i do doesnt work. I keep getting an error. It does not matter what connection settings I use or options, it yields the same error every time. VS Blazor scaffolding has created the localDB connection and data. It is there. There connection string is for a localDB ...

"Server=(localdb)\mssqllocaldb;Database=Licenses;Trusted_Connection=True;MultipleActiveResultSets=true"

... but power tools just won't connect.

I cannot populate database name because the connection to the instance isn't working so nothing is retrieved here.

image

If i try custom connection , using connection string as above with MYSQL selected, another error is generated:

image

Provide technical details

ErikEJ commented 3 months ago

I think you have an extra \ in the name

DrHoneyBear commented 3 months ago

Hi.. But that is the connection string from VS. it works in sql sever studio. so..?

On Fri, 2 Aug 2024, 13:41 Erik Ejlskov Jensen, @.***> wrote:

I think you have an extra \ in the name

— Reply to this email directly, view it on GitHub https://github.com/ErikEJ/EFCorePowerTools/issues/2447#issuecomment-2265292091, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO5LT6NYGQNJKVGDQQ6QNNTZPN5AXAVCNFSM6AAAAABL4PBF7CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRVGI4TEMBZGE . You are receiving this because you authored the thread.Message ID: @.***>

ErikEJ commented 3 months ago

Have you tried without the double \ ??

DrHoneyBear commented 3 months ago

hi hang on! just realised, the \ is to escape the \ in the connection string i think.

I have left home so will try this later with a single \ in your app.

On Fri, 2 Aug 2024, 13:53 Erik Ejlskov Jensen, @.***> wrote:

Have you tried with double \ ??

— Reply to this email directly, view it on GitHub https://github.com/ErikEJ/EFCorePowerTools/issues/2447#issuecomment-2265336450, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO5LT6I3HALESW7E5PVLAZTZPN6NNAVCNFSM6AAAAABL4PBF7CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRVGMZTMNBVGA . You are receiving this because you authored the thread.Message ID: @.***>

DrHoneyBear commented 3 months ago

Hi Erik YES, YOU ARE CORRECT There was 2x \ instead of 1 All works perfect🤟

On Fri, 2 Aug 2024, 14:23 D, @.***> wrote:

hi hang on! just realised, the \ is to escape the \ in the connection string i think.

I have left home so will try this later with a single \ in your app.

On Fri, 2 Aug 2024, 13:53 Erik Ejlskov Jensen, @.***> wrote:

Have you tried with double \ ??

— Reply to this email directly, view it on GitHub https://github.com/ErikEJ/EFCorePowerTools/issues/2447#issuecomment-2265336450, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO5LT6I3HALESW7E5PVLAZTZPN6NNAVCNFSM6AAAAABL4PBF7CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRVGMZTMNBVGA . You are receiving this because you authored the thread.Message ID: @.***>

ErikEJ commented 3 months ago

Great!

If you like my free tools, I would be very grateful for a rating or review on Visual Studio Marketplace or even a one-time or monthly sponsorship

DrHoneyBear commented 3 months ago

No prob Erik I use this tool once to scaffold the code then i expect to be working with my code for about a year So I've made a one time sponsorship today Cheers!

On Sat, 3 Aug 2024, 11:15 Erik Ejlskov Jensen, @.***> wrote:

Great!

If you like my free tools, I would be very grateful for a rating or review on Visual Studio Marketplace https://marketplace.visualstudio.com/items?itemName=ErikEJ.EFCorePowerTools&ssr=false#review-details or even a one-time or monthly sponsorship https://github.com/sponsors/ErikEJ?frequency=one-time&sponsor=ErikEJ

— Reply to this email directly, view it on GitHub https://github.com/ErikEJ/EFCorePowerTools/issues/2447#issuecomment-2266664301, or unsubscribe https://github.com/notifications/unsubscribe-auth/AO5LT6K4YBHPJMSKJXQD3TTZPSUULAVCNFSM6AAAAABL4PBF7CVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDENRWGY3DIMZQGE . You are receiving this because you authored the thread.Message ID: @.***>