-
Notifications
You must be signed in to change notification settings - Fork 3.2k
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
AttachDBFileName fails if the value includes |DataDirectory| #17723
Comments
.NET Core SqlClient does not expand DataDirectory? |
Yes, if I use "|DataDirectory|" the connection fails. |
Duplicate of dotnet/SqlClient#16 |
Do not understand the reason for the closure. Code that worked with .Net, EF Core 2.26 and WPF does not work with .Net Core 3.0 Preview 9, EF Core 3.0 Preview 9 and Wpf. Oh well ... |
This is not an issue with EF, but with SqlClient the issue dotnet/SqlClient#16 is tracking the work that needs to be done to fix it. |
Please upvote it and subscribe to it for updates. |
My PR to fix this has just been merged, and wil be part of the 1.1 release |
@ErikEJ Awesome! Really appreciate your perseverance! |
I have a WPF Prism application working with Entity Framework Core 2.26. The OnConfiguring method optionsBuilder.UseSqlServer call includes the following in the connect string:
AttachDBFileName=|DataDirectory|\dbfiles\my.mdf;
I created a new project that uses .Net Core 3.0 Preview 9 and Entity Framework Core 3.0 Preview 9. At runtime the same connection string fails. I get a System.ArgumentException with the message "Invalid value for key 'attachdbfilename'."
"|DataDirectory|" appears to be the problem. AttachDBFileName with the full path works fine. If I build up the full path using the value AppDomain.CurrentDomain.BaseDirectory the attach will also work.
The text was updated successfully, but these errors were encountered: