瀏覽代碼

support mode : TableToFile(default), RowMapToFile , TableToDir

Lith 7 月之前
父節點
當前提交
d8db1817f5
共有 52 個文件被更改,包括 278 次插入22 次删除
  1. 4 2
      README.md
  2. 40 12
      Vitorm.File.sln
  3. 6 0
      doc/ReleaseNotes.md
  4. 2 2
      src/Vitorm.File/DbConfig.cs
  5. 3 0
      src/Vitorm.File/DbContext.cs
  6. 1 1
      src/Vitorm.File/DbSetConstructor.cs
  7. 39 0
      test/Vitorm.File.RowMapToFile.Data.MsTest/Vitorm.File.RowMapToFile.Data.MsTest.csproj
  8. 12 0
      test/Vitorm.File.RowMapToFile.Data.MsTest/appsettings.json
  9. 36 0
      test/Vitorm.File.RowMapToFile.MsTest/Vitorm.File.RowMapToFile.MsTest.csproj
  10. 12 0
      test/Vitorm.File.RowMapToFile.MsTest/appsettings.json
  11. 39 0
      test/Vitorm.File.TableToDir.Data.MsTest/Vitorm.File.TableToDir.Data.MsTest.csproj
  12. 1 0
      test/Vitorm.File.TableToDir.Data.MsTest/appsettings.json
  13. 36 0
      test/Vitorm.File.TableToDir.MsTest/Vitorm.File.TableToDir.MsTest.csproj
  14. 12 0
      test/Vitorm.File.TableToDir.MsTest/appsettings.json
  15. 0 0
      test/Vitorm.File.TableToFile.Data.MsTest/CommonTest/Common_Test.cs
  16. 0 0
      test/Vitorm.File.TableToFile.Data.MsTest/CommonTest/UserTest.Entity.cs
  17. 0 0
      test/Vitorm.File.TableToFile.Data.MsTest/CommonTest/UserTest.cs
  18. 0 0
      test/Vitorm.File.TableToFile.Data.MsTest/CommonTest/UserTestAsync.cs
  19. 0 0
      test/Vitorm.File.TableToFile.Data.MsTest/Vitorm.File.TableToFile.Data.MsTest.csproj
  20. 12 0
      test/Vitorm.File.TableToFile.Data.MsTest/appsettings.json
  21. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/CRUDAsync_Test.cs
  22. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/CRUD_Test.cs
  23. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/ChangeDatabase_Test.cs
  24. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/ChangeTable_Test.cs
  25. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/EntityLoader_CustomLoader_Test.cs
  26. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/EntityLoader_Test.cs
  27. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_Bool_Test.cs
  28. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_DateTime_Test.cs
  29. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_Numeric_Calculate_Test.cs
  30. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_Numeric_Test.cs
  31. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_String_Calculate_Test.cs
  32. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_String_Like_Test.cs
  33. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_String_Test.cs
  34. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_Test.cs
  35. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_Count_Test.cs
  36. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_Distinct_Test.cs
  37. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_FilterRule_Test.cs
  38. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_FilterRule_WithJoin_Test.cs
  39. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_Group_Test.cs
  40. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_InnerJoin_ByJoin_Test.cs
  41. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_InnerJoin_BySelectMany_Test.cs
  42. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_LeftJoin_ByGroupJoin_Test.cs
  43. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_LeftJoin_BySelectMany_Test.cs
  44. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_Method_Test.cs
  45. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_ScopeParam_LeftJoin_Test.cs
  46. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_ScopeParam_Test.cs
  47. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_Select_Test.cs
  48. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Schema_Test.cs
  49. 0 0
      test/Vitorm.File.TableToFile.MsTest/CommonTest/Truncate_Test.cs
  50. 5 3
      test/Vitorm.File.TableToFile.MsTest/DataSource.cs
  51. 6 2
      test/Vitorm.File.TableToFile.MsTest/Vitorm.File.TableToFile.MsTest.csproj
  52. 12 0
      test/Vitorm.File.TableToFile.MsTest/appsettings.json

+ 4 - 2
README.md

@@ -20,7 +20,7 @@ mode: TableToDir
     table               :   "xxx/{{databaseName}}/{{tableName}}"
     row                 :   "xxx/{{databaseName}}/{{tableName}}/{{key}}.json"
 
-mode: TableToFile(default),RowMapToFile
+mode: TableToFile(default), RowMapToFile
     connectionString    :   "xxx/{{databaseName}}"
     table               :   "xxx/{{databaseName}}/{{tableName}}.json"
 
@@ -201,6 +201,7 @@ dotnet add package Vitorm.File
     "Data": [
       {
         "provider": "File",
+        "mode": "TableToFile",
         "namespace": "App",
         "connectionString": "Data/db_orm"
       }
@@ -313,7 +314,8 @@ namespace App
 
 
 # Examples:  
-[Test Example](https://github.com/Vit-Orm/Vitorm.File/tree/master/test/Vitorm.File.MsTest)    
+[Vitorm Example](https://github.com/Vit-Orm/Vitorm.File/tree/master/test/Vitorm.File.TableToFile.MsTest)    
+[Vitorm.Data Example](https://github.com/Vit-Orm/Vitorm.File/tree/master/test/Vitorm.File.Data.TableToFile.MsTest)    
 
 
 

+ 40 - 12
Vitorm.File.sln

@@ -19,9 +19,17 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "src", "src", "{05176905-A2A
 EndProject
 Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vitorm.File", "src\Vitorm.File\Vitorm.File.csproj", "{7AC01F47-AD5A-4B61-9F05-38094C1EF23B}"
 EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vitorm.File.MsTest", "test\Vitorm.File.MsTest\Vitorm.File.MsTest.csproj", "{42E0FE60-9E3B-4B59-A69E-E50A20C89D6D}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vitorm.File.TableToDir.MsTest", "test\Vitorm.File.TableToDir.MsTest\Vitorm.File.TableToDir.MsTest.csproj", "{9680663A-153D-4A9A-AEEA-B19FC87387B2}"
 EndProject
-Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Vitorm.File.Data.MsTest", "test\Vitorm.File.Data.MsTest\Vitorm.File.Data.MsTest.csproj", "{EB69697B-0CDB-4A28-AACF-22C31137DDE9}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vitorm.File.TableToFile.Data.MsTest", "test\Vitorm.File.TableToFile.Data.MsTest\Vitorm.File.TableToFile.Data.MsTest.csproj", "{8E09B825-1A18-4396-A511-36C223F89929}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vitorm.File.TableToFile.MsTest", "test\Vitorm.File.TableToFile.MsTest\Vitorm.File.TableToFile.MsTest.csproj", "{06FAF2EB-B9B4-48FE-BDC6-A23EF641810A}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vitorm.File.TableToDir.Data.MsTest", "test\Vitorm.File.TableToDir.Data.MsTest\Vitorm.File.TableToDir.Data.MsTest.csproj", "{320C7A91-D550-45BE-AE91-88C048D66BC9}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vitorm.File.RowMapToFile.Data.MsTest", "test\Vitorm.File.RowMapToFile.Data.MsTest\Vitorm.File.RowMapToFile.Data.MsTest.csproj", "{40485AE4-63B6-4343-96D1-368A260A369F}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Vitorm.File.RowMapToFile.MsTest", "test\Vitorm.File.RowMapToFile.MsTest\Vitorm.File.RowMapToFile.MsTest.csproj", "{ADAFA427-7133-4D5F-90A0-874D9338D4AF}"
 EndProject
 Global
 	GlobalSection(SolutionConfigurationPlatforms) = preSolution
@@ -33,22 +41,42 @@ Global
 		{7AC01F47-AD5A-4B61-9F05-38094C1EF23B}.Debug|Any CPU.Build.0 = Debug|Any CPU
 		{7AC01F47-AD5A-4B61-9F05-38094C1EF23B}.Release|Any CPU.ActiveCfg = Release|Any CPU
 		{7AC01F47-AD5A-4B61-9F05-38094C1EF23B}.Release|Any CPU.Build.0 = Release|Any CPU
-		{42E0FE60-9E3B-4B59-A69E-E50A20C89D6D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{42E0FE60-9E3B-4B59-A69E-E50A20C89D6D}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{42E0FE60-9E3B-4B59-A69E-E50A20C89D6D}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{42E0FE60-9E3B-4B59-A69E-E50A20C89D6D}.Release|Any CPU.Build.0 = Release|Any CPU
-		{EB69697B-0CDB-4A28-AACF-22C31137DDE9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
-		{EB69697B-0CDB-4A28-AACF-22C31137DDE9}.Debug|Any CPU.Build.0 = Debug|Any CPU
-		{EB69697B-0CDB-4A28-AACF-22C31137DDE9}.Release|Any CPU.ActiveCfg = Release|Any CPU
-		{EB69697B-0CDB-4A28-AACF-22C31137DDE9}.Release|Any CPU.Build.0 = Release|Any CPU
+		{9680663A-153D-4A9A-AEEA-B19FC87387B2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{9680663A-153D-4A9A-AEEA-B19FC87387B2}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{9680663A-153D-4A9A-AEEA-B19FC87387B2}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{9680663A-153D-4A9A-AEEA-B19FC87387B2}.Release|Any CPU.Build.0 = Release|Any CPU
+		{8E09B825-1A18-4396-A511-36C223F89929}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{8E09B825-1A18-4396-A511-36C223F89929}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{8E09B825-1A18-4396-A511-36C223F89929}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{8E09B825-1A18-4396-A511-36C223F89929}.Release|Any CPU.Build.0 = Release|Any CPU
+		{06FAF2EB-B9B4-48FE-BDC6-A23EF641810A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{06FAF2EB-B9B4-48FE-BDC6-A23EF641810A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{06FAF2EB-B9B4-48FE-BDC6-A23EF641810A}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{06FAF2EB-B9B4-48FE-BDC6-A23EF641810A}.Release|Any CPU.Build.0 = Release|Any CPU
+		{320C7A91-D550-45BE-AE91-88C048D66BC9}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{320C7A91-D550-45BE-AE91-88C048D66BC9}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{320C7A91-D550-45BE-AE91-88C048D66BC9}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{320C7A91-D550-45BE-AE91-88C048D66BC9}.Release|Any CPU.Build.0 = Release|Any CPU
+		{40485AE4-63B6-4343-96D1-368A260A369F}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{40485AE4-63B6-4343-96D1-368A260A369F}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{40485AE4-63B6-4343-96D1-368A260A369F}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{40485AE4-63B6-4343-96D1-368A260A369F}.Release|Any CPU.Build.0 = Release|Any CPU
+		{ADAFA427-7133-4D5F-90A0-874D9338D4AF}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+		{ADAFA427-7133-4D5F-90A0-874D9338D4AF}.Debug|Any CPU.Build.0 = Debug|Any CPU
+		{ADAFA427-7133-4D5F-90A0-874D9338D4AF}.Release|Any CPU.ActiveCfg = Release|Any CPU
+		{ADAFA427-7133-4D5F-90A0-874D9338D4AF}.Release|Any CPU.Build.0 = Release|Any CPU
 	EndGlobalSection
 	GlobalSection(SolutionProperties) = preSolution
 		HideSolutionNode = FALSE
 	EndGlobalSection
 	GlobalSection(NestedProjects) = preSolution
 		{7AC01F47-AD5A-4B61-9F05-38094C1EF23B} = {05176905-A2A5-4015-9F04-2904506C902F}
-		{42E0FE60-9E3B-4B59-A69E-E50A20C89D6D} = {7904FE51-04FF-4477-8E3A-CC340389EE32}
-		{EB69697B-0CDB-4A28-AACF-22C31137DDE9} = {7904FE51-04FF-4477-8E3A-CC340389EE32}
+		{9680663A-153D-4A9A-AEEA-B19FC87387B2} = {7904FE51-04FF-4477-8E3A-CC340389EE32}
+		{8E09B825-1A18-4396-A511-36C223F89929} = {7904FE51-04FF-4477-8E3A-CC340389EE32}
+		{06FAF2EB-B9B4-48FE-BDC6-A23EF641810A} = {7904FE51-04FF-4477-8E3A-CC340389EE32}
+		{320C7A91-D550-45BE-AE91-88C048D66BC9} = {7904FE51-04FF-4477-8E3A-CC340389EE32}
+		{40485AE4-63B6-4343-96D1-368A260A369F} = {7904FE51-04FF-4477-8E3A-CC340389EE32}
+		{ADAFA427-7133-4D5F-90A0-874D9338D4AF} = {7904FE51-04FF-4477-8E3A-CC340389EE32}
 	EndGlobalSection
 	GlobalSection(ExtensibilityGlobals) = postSolution
 		SolutionGuid = {C7DA16E3-9949-49FA-B0B4-F830636DE60F}

+ 6 - 0
doc/ReleaseNotes.md

@@ -1 +1,7 @@
 # Vitorm.File ReleaseNotes
+
+-----------------------
+# 2.2.0
+- support mode : TableToFile(default), RowMapToFile , TableToDir
+
+

+ 2 - 2
src/Vitorm.File/DbConfig.cs

@@ -42,9 +42,9 @@ namespace Vitorm.File
         {
             var _connectionString = Path.Combine(Path.GetDirectoryName(connectionString), databaseName);
 
-            return new DbConfig(_connectionString);
+            return new DbConfig(_connectionString, mode);
         }
 
-        internal string dbHashCode => connectionString.GetHashCode().ToString();
+        internal string dbHashCode => (connectionString + (mode ?? "TableToFile")).GetHashCode().ToString();
     }
 }

+ 3 - 0
src/Vitorm.File/DbContext.cs

@@ -14,6 +14,9 @@ namespace Vitorm.File
         public DbContext(string connectionString) : this(new DbConfig(connectionString))
         {
         }
+        public DbContext(string connectionString, string mode) : this(new DbConfig(connectionString, mode))
+        {
+        }
 
 
         #region Transaction

+ 1 - 1
src/Vitorm.File/DbSetConstructor.cs

@@ -19,7 +19,7 @@ namespace Vitorm.File
         {
             // TableToFile(default), TableToDir , RowMapToFile
             if (dbContext.dbConfig.mode == "TableToDir") return new DbSet_TableToDir<Entity, EntityKey>(dbContext, entityDescriptor);
-            if (dbContext.dbConfig.mode == "TableMapToFile") return new DbSet_RowMapToFile<Entity, EntityKey>(dbContext, entityDescriptor);
+            if (dbContext.dbConfig.mode == "RowMapToFile") return new DbSet_RowMapToFile<Entity, EntityKey>(dbContext, entityDescriptor);
 
             return new DbSet_TableToFile<Entity, EntityKey>(dbContext, entityDescriptor);
         }

+ 39 - 0
test/Vitorm.File.RowMapToFile.Data.MsTest/Vitorm.File.RowMapToFile.Data.MsTest.csproj

@@ -0,0 +1,39 @@
+<Project Sdk="Microsoft.NET.Sdk">
+    <Import Project="..\..\src\Versions.props" />
+
+    <PropertyGroup>
+        <test>MSTest</test>
+    </PropertyGroup>
+
+    <PropertyGroup>
+        <TargetFramework>net6.0</TargetFramework>
+        <ImplicitUsings>enable</ImplicitUsings>
+
+        <IsPackable>false</IsPackable>
+        <IsTestProject>true</IsTestProject>
+        <RootNamespace>Vitorm.MsTest</RootNamespace>
+    </PropertyGroup>
+
+    <ItemGroup>
+        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
+        <PackageReference Include="MSTest.TestAdapter" Version="3.5.2" />
+        <PackageReference Include="MSTest.TestFramework" Version="3.5.2" />
+
+        <PackageReference Include="Vitorm.Data" Version="$(Vitorm_Version)"  />
+    </ItemGroup>
+
+    <ItemGroup>
+        <ProjectReference Include="..\..\src\Vitorm.File\Vitorm.File.csproj" />
+    </ItemGroup>
+
+    <ItemGroup>
+        <Compile Include="..\Vitorm.File.TableToFile.Data.MsTest\CommonTest\*.cs" Link="CommonTest\%(RecursiveDir)%(FileName)%(Extension)" />
+    </ItemGroup>
+    
+    <ItemGroup>
+        <None Update="appsettings.json">
+            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+        </None>
+    </ItemGroup>
+
+</Project>

+ 12 - 0
test/Vitorm.File.RowMapToFile.Data.MsTest/appsettings.json

@@ -0,0 +1,12 @@
+{
+  "Vitorm": {
+    "Data": [
+      {
+        "provider": "File",
+        "mode": "RowMapToFile",
+        "namespace": "Vitorm.MsTest",
+        "connectionString": "Data/db_orm"
+      }
+    ]
+  }
+}

+ 36 - 0
test/Vitorm.File.RowMapToFile.MsTest/Vitorm.File.RowMapToFile.MsTest.csproj

@@ -0,0 +1,36 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+    <PropertyGroup>
+        <test>MSTest</test>
+    </PropertyGroup>
+
+    <PropertyGroup>
+        <TargetFramework>net6.0</TargetFramework>
+        <ImplicitUsings>enable</ImplicitUsings>
+        <IsPackable>false</IsPackable>
+        <IsTestProject>true</IsTestProject>
+        <RootNamespace>Vitorm.MsTest</RootNamespace>
+    </PropertyGroup>
+
+    <ItemGroup>
+        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
+        <PackageReference Include="MSTest.TestAdapter" Version="3.5.2" />
+        <PackageReference Include="MSTest.TestFramework" Version="3.5.2" />
+    </ItemGroup>
+
+    <ItemGroup>
+        <ProjectReference Include="..\..\src\Vitorm.File\Vitorm.File.csproj" />
+    </ItemGroup>
+
+    <ItemGroup>
+        <Compile Include="..\Vitorm.File.TableToFile.MsTest\CommonTest\*.cs" Link="CommonTest\%(RecursiveDir)%(FileName)%(Extension)" />
+        <Compile Include="..\Vitorm.File.TableToFile.MsTest\DataSource.cs" Link="DataSource.cs" />
+    </ItemGroup>
+
+    <ItemGroup>
+        <None Update="appsettings.json">
+            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+        </None>
+    </ItemGroup>
+
+</Project>

+ 12 - 0
test/Vitorm.File.RowMapToFile.MsTest/appsettings.json

@@ -0,0 +1,12 @@
+{
+  "Vitorm": {
+    "Data": [
+      {
+        "provider": "File",
+        "mode": "RowMapToFile",
+        "namespace": "Vitorm.MsTest",
+        "connectionString": "Data/db_orm"
+      }
+    ]
+  }
+}

+ 39 - 0
test/Vitorm.File.TableToDir.Data.MsTest/Vitorm.File.TableToDir.Data.MsTest.csproj

@@ -0,0 +1,39 @@
+<Project Sdk="Microsoft.NET.Sdk">
+    <Import Project="..\..\src\Versions.props" />
+
+    <PropertyGroup>
+        <test>MSTest</test>
+    </PropertyGroup>
+
+    <PropertyGroup>
+        <TargetFramework>net6.0</TargetFramework>
+        <ImplicitUsings>enable</ImplicitUsings>
+
+        <IsPackable>false</IsPackable>
+        <IsTestProject>true</IsTestProject>
+        <RootNamespace>Vitorm.MsTest</RootNamespace>
+    </PropertyGroup>
+
+    <ItemGroup>
+        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
+        <PackageReference Include="MSTest.TestAdapter" Version="3.5.2" />
+        <PackageReference Include="MSTest.TestFramework" Version="3.5.2" />
+
+        <PackageReference Include="Vitorm.Data" Version="$(Vitorm_Version)"  />
+    </ItemGroup>
+
+    <ItemGroup>
+        <ProjectReference Include="..\..\src\Vitorm.File\Vitorm.File.csproj" />
+    </ItemGroup>
+
+    <ItemGroup>
+        <Compile Include="..\Vitorm.File.TableToFile.Data.MsTest\CommonTest\*.cs" Link="CommonTest\%(RecursiveDir)%(FileName)%(Extension)" />
+    </ItemGroup>
+    
+    <ItemGroup>
+        <None Update="appsettings.json">
+            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+        </None>
+    </ItemGroup>
+
+</Project>

+ 1 - 0
test/Vitorm.File.Data.MsTest/appsettings.json → test/Vitorm.File.TableToDir.Data.MsTest/appsettings.json

@@ -3,6 +3,7 @@
     "Data": [
       {
         "provider": "File",
+        "mode": "TableToDir",
         "namespace": "Vitorm.MsTest",
         "connectionString": "Data/db_orm"
       }

+ 36 - 0
test/Vitorm.File.TableToDir.MsTest/Vitorm.File.TableToDir.MsTest.csproj

@@ -0,0 +1,36 @@
+<Project Sdk="Microsoft.NET.Sdk">
+
+    <PropertyGroup>
+        <test>MSTest</test>
+    </PropertyGroup>
+
+    <PropertyGroup>
+        <TargetFramework>net6.0</TargetFramework>
+        <ImplicitUsings>enable</ImplicitUsings>
+        <IsPackable>false</IsPackable>
+        <IsTestProject>true</IsTestProject>
+        <RootNamespace>Vitorm.MsTest</RootNamespace>
+    </PropertyGroup>
+
+    <ItemGroup>
+        <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
+        <PackageReference Include="MSTest.TestAdapter" Version="3.5.2" />
+        <PackageReference Include="MSTest.TestFramework" Version="3.5.2" />
+    </ItemGroup>
+
+    <ItemGroup>
+        <ProjectReference Include="..\..\src\Vitorm.File\Vitorm.File.csproj" />
+    </ItemGroup>
+
+    <ItemGroup>
+        <Compile Include="..\Vitorm.File.TableToFile.MsTest\CommonTest\*.cs" Link="CommonTest\%(RecursiveDir)%(FileName)%(Extension)" />
+        <Compile Include="..\Vitorm.File.TableToFile.MsTest\DataSource.cs" Link="DataSource.cs" />
+    </ItemGroup>
+
+    <ItemGroup>
+        <None Update="appsettings.json">
+            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+        </None>
+    </ItemGroup>
+
+</Project>

+ 12 - 0
test/Vitorm.File.TableToDir.MsTest/appsettings.json

@@ -0,0 +1,12 @@
+{
+  "Vitorm": {
+    "Data": [
+      {
+        "provider": "File",
+        "mode": "TableToDir",
+        "namespace": "Vitorm.MsTest",
+        "connectionString": "Data/db_orm"
+      }
+    ]
+  }
+}

+ 0 - 0
test/Vitorm.File.Data.MsTest/CommonTest/Common_Test.cs → test/Vitorm.File.TableToFile.Data.MsTest/CommonTest/Common_Test.cs


+ 0 - 0
test/Vitorm.File.Data.MsTest/CommonTest/UserTest.Entity.cs → test/Vitorm.File.TableToFile.Data.MsTest/CommonTest/UserTest.Entity.cs


+ 0 - 0
test/Vitorm.File.Data.MsTest/CommonTest/UserTest.cs → test/Vitorm.File.TableToFile.Data.MsTest/CommonTest/UserTest.cs


+ 0 - 0
test/Vitorm.File.Data.MsTest/CommonTest/UserTestAsync.cs → test/Vitorm.File.TableToFile.Data.MsTest/CommonTest/UserTestAsync.cs


+ 0 - 0
test/Vitorm.File.Data.MsTest/Vitorm.File.Data.MsTest.csproj → test/Vitorm.File.TableToFile.Data.MsTest/Vitorm.File.TableToFile.Data.MsTest.csproj


+ 12 - 0
test/Vitorm.File.TableToFile.Data.MsTest/appsettings.json

@@ -0,0 +1,12 @@
+{
+  "Vitorm": {
+    "Data": [
+      {
+        "provider": "File",
+        "mode": "TableToFile",
+        "namespace": "Vitorm.MsTest",
+        "connectionString": "Data/db_orm"
+      }
+    ]
+  }
+}

+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/CRUDAsync_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/CRUDAsync_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/CRUD_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/CRUD_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/ChangeDatabase_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/ChangeDatabase_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/ChangeTable_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/ChangeTable_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/EntityLoader_CustomLoader_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/EntityLoader_CustomLoader_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/EntityLoader_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/EntityLoader_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Property_Bool_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_Bool_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Property_DateTime_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_DateTime_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Property_Numeric_Calculate_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_Numeric_Calculate_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Property_Numeric_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_Numeric_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Property_String_Calculate_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_String_Calculate_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Property_String_Like_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_String_Like_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Property_String_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_String_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Property_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Property_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Query_Count_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_Count_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Query_Distinct_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_Distinct_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Query_FilterRule_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_FilterRule_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Query_FilterRule_WithJoin_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_FilterRule_WithJoin_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Query_Group_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_Group_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Query_InnerJoin_ByJoin_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_InnerJoin_ByJoin_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Query_InnerJoin_BySelectMany_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_InnerJoin_BySelectMany_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Query_LeftJoin_ByGroupJoin_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_LeftJoin_ByGroupJoin_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Query_LeftJoin_BySelectMany_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_LeftJoin_BySelectMany_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Query_Method_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_Method_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Query_ScopeParam_LeftJoin_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_ScopeParam_LeftJoin_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Query_ScopeParam_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_ScopeParam_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Query_Select_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Query_Select_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Schema_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Schema_Test.cs


+ 0 - 0
test/Vitorm.File.MsTest/CommonTest/Truncate_Test.cs → test/Vitorm.File.TableToFile.MsTest/CommonTest/Truncate_Test.cs


+ 5 - 3
test/Vitorm.File.MsTest/DataSource.cs → test/Vitorm.File.TableToFile.MsTest/DataSource.cs

@@ -1,5 +1,7 @@
 namespace Vitorm.MsTest
 {
+    using Vit.Core.Util.ConfigurationManager;
+
     using DbContext = Vitorm.File.DbContext;
 
     [System.ComponentModel.DataAnnotations.Schema.Table("User")]
@@ -59,10 +61,10 @@
         public static DbContext CreateDbContextForWriting(bool autoInit = true) => CreateDbContext(autoInit);
         public static DbContext CreateDbContext(bool autoInit = true)
         {
-            var guid = Guid.NewGuid().ToString();
-            var filePath = Path.Combine(System.AppDomain.CurrentDomain.BaseDirectory, "Data", $"{guid}");
+            string connectionString = Appsettings.json.GetStringByPath("Vitorm.Data[0].connectionString");
+            string mode = Appsettings.json.GetStringByPath("Vitorm.Data[0].mode");
 
-            var dbContext = new Vitorm.File.DbContext(filePath);
+            var dbContext = new Vitorm.File.DbContext(connectionString, mode);
 
             if (autoInit)
                 InitDbContext(dbContext);

+ 6 - 2
test/Vitorm.File.MsTest/Vitorm.File.MsTest.csproj → test/Vitorm.File.TableToFile.MsTest/Vitorm.File.TableToFile.MsTest.csproj

@@ -14,15 +14,19 @@
     </PropertyGroup>
 
     <ItemGroup>
-        <PackageReference Include="Microsoft.Bcl.AsyncInterfaces" Version="8.0.0" />
         <PackageReference Include="Microsoft.NET.Test.Sdk" Version="17.11.0" />
         <PackageReference Include="MSTest.TestAdapter" Version="3.5.2" />
         <PackageReference Include="MSTest.TestFramework" Version="3.5.2" />
+    </ItemGroup>
 
+    <ItemGroup>
+        <ProjectReference Include="..\..\src\Vitorm.File\Vitorm.File.csproj" />
     </ItemGroup>
 
     <ItemGroup>
-      <ProjectReference Include="..\..\src\Vitorm.File\Vitorm.File.csproj" />
+        <None Update="appsettings.json">
+            <CopyToOutputDirectory>Always</CopyToOutputDirectory>
+        </None>
     </ItemGroup>
 
 </Project>

+ 12 - 0
test/Vitorm.File.TableToFile.MsTest/appsettings.json

@@ -0,0 +1,12 @@
+{
+  "Vitorm": {
+    "Data": [
+      {
+        "provider": "File",
+        "mode": "TableToFile",
+        "namespace": "Vitorm.MsTest",
+        "connectionString": "Data/db_orm"
+      }
+    ]
+  }
+}