Skip to content

Commit 33ed384

Browse files
committed
[AppInfra] Fix database attach by rename .App_Data as _App_Data
1 parent 1dde76b commit 33ed384

4 files changed

Lines changed: 8 additions & 8 deletions

File tree

AppInfraDemo/DemoApplication.sln

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -64,18 +64,18 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".Exercises", ".Exercises",
6464
.Exercises\readme.md = .Exercises\readme.md
6565
EndProjectSection
6666
EndProject
67-
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = ".App_Data", ".App_Data", "{E42085D5-D451-49ED-89A7-962B5FE83C3D}"
68-
ProjectSection(SolutionItems) = preProject
69-
.App_Data\readme.md = .App_Data\readme.md
70-
EndProjectSection
71-
EndProject
7267
Project("{F088123C-0E9E-452A-89E6-6BA2F21D5CAC}") = "DependencyValidation", "Infrastructure\DependencyValidation\DependencyValidation.modelproj", "{9D8284B2-4F4E-40F7-B194-3F16F4E1E51B}"
7368
EndProject
7469
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{4A532F73-79FC-431C-B849-02EAF64507E2}"
7570
ProjectSection(SolutionItems) = preProject
7671
.editorconfig = .editorconfig
7772
EndProjectSection
7873
EndProject
74+
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "_App_Data", "_App_Data", "{D12E3252-BC08-4F07-AB99-BF6A62D5409B}"
75+
ProjectSection(SolutionItems) = preProject
76+
_App_Data\readme.md = _App_Data\readme.md
77+
EndProjectSection
78+
EndProject
7979
Global
8080
GlobalSection(SolutionConfigurationPlatforms) = preSolution
8181
Debug|Any CPU = Debug|Any CPU

AppInfraDemo/UI/ConsoleApplication/Program.cs

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -64,7 +64,7 @@ private static IEnumerable<Assembly> GetApplicationAssemblies()
6464
private static void SetupDataDirectory()
6565
{
6666
string baseDirectory = AppDomain.CurrentDomain.BaseDirectory;
67-
AppDomain.CurrentDomain.SetData("DataDirectory", Path.GetFullPath(Path.Combine(baseDirectory, @"..\..\.App_Data")));
67+
AppDomain.CurrentDomain.SetData("DataDirectory", Path.GetFullPath(Path.Combine(baseDirectory, @"..\..\App_Data")));
6868
}
6969
}
7070
}
Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
Use this folder when you want to use the AdventureWorks2012 database from the local SQL Express.
22
-----------------
33

4-
The `AppInfraDemo\.App_Data` folder should contain the `AdventureWorks2012.mdf` in order to be attached to the local database on the application start.
4+
The `AppInfraDemo\_App_Data` folder should contain the `AdventureWorks2012.mdf` in order to be attached to the local database on the application start.
55

66
To configure this follow these steps:
77
1. Download the `AdventureWorks2012.mdf` from [https://1drv.ms/u/s!AttpJoJRCtSQiiG8WJT8t3C4y450](https://1drv.ms/u/s!AttpJoJRCtSQiiG8WJT8t3C4y450)
8-
2. Copy it to `AppInfraDemo\.App_Data` folder
8+
2. Copy it to `AppInfraDemo\_App_Data` folder
99
3. Make sure that your host app sets the |DataDirectory| on the AppDomain
1010
- see `AppInfraDemo\UI\ConsoleApplication\Program.SetupDataDirectory()`
1111
4. Set the connection string that uses `AttachDbFilename` setting

0 commit comments

Comments
 (0)