I was unable to find this information easily, had to play around with some things myself to find it. I’m hoping by posting here, others will be able to find it easier than I did.
If you want to create a named pipe for localdb, you can use the sqllocaldb.exe tool in command prompt.
If you want to create a new localDb, do the command:
sqllocaldb create "Local Database Name Here"
After that, you will need to start the localdb by doing:
sqllocaldb start "Local Database Name Here"
Once you’ve started it, you can use info provided by the info command to get the named pipe uri.
sqllocaldb info "Local Database Name Here"
That’s all there is to it.
I’ll add more info later to see about creating and fetching the info via code.
Looked into doing this via code and I was going to provide a p/invoked class to use but I found one already made that works really well.
You can find the NuGet package by typing the following into the Package Manager Window in Visual Studio:
Or by downloading from the website here:
Usage is pretty simple:
Your info object now contains a bunch of information about your LocalDatabase. The named pipe is under the info.NamedPipe attribute. That’s all you need to do for accessing your LocalDb info in C# code! Comment below if you have any questions or want to contribute anything!