Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP
Browse files

Merge pull request #2 from bricelam/master

Update to 6.0.0-beta1
  • Loading branch information...
commit 70998a4be0ed566ad3f21d6c5a51016b7c16f9bd 2 parents a5fadde + 41b9f7c
@marek-safar marek-safar authored
Showing with 10,246 additions and 10,323 deletions.
  1. +3 −1 .gitignore
  2. +19 −13 .nuget/NuGet.targets
  3. +7 −0 .nuget/packages.config
  4. +1 −1  Build.cmd
  5. +67 −29 EF.msbuild
  6. +0 −20 EF.xunit.targets
  7. +0 −1  EntityFramework.sln
  8. +62 −62 EntityFramework.sln.DotSettings
  9. +6 −0 src/{EntityFramework/Utilities → Common}/ByteExtensions.cs
  10. +7 −1 src/{EntityFramework.SqlServerCompact/Utilities → Common}/Check.cs
  11. +8 −2 src/{EntityFramework/Utilities → Common}/DatabaseName.cs
  12. +6 −0 src/{EntityFramework/Utilities → Common}/DebugCheck.cs
  13. +6 −0 src/{EntityFramework/Utilities → Common}/IEnumerableExtensions.cs
  14. +7 −1 src/{EntityFramework/Utilities → Common}/StringExtensions.cs
  15. +0 −3  src/EntityFramework.PowerShell.Utility/EntityFramework.PowerShell.Utility.csproj
  16. +38 −0 src/EntityFramework.PowerShell/ConnectionFactoryConfig/AddDefaultConnectionFactoryCommand.cs
  17. +39 −0 src/EntityFramework.PowerShell/ConnectionFactoryConfig/AddProviderCommand.cs
  18. +65 −1 src/EntityFramework.PowerShell/ConnectionFactoryConfig/ConfigFileManipulator.cs
  19. +0 −55 src/EntityFramework.PowerShell/ConnectionFactoryConfig/ConnectionFactoryConfigurator.cs
  20. +40 −0 src/EntityFramework.PowerShell/ConnectionFactoryConfig/InitializeEntityFrameworkCommand.cs
  21. +57 −0 src/EntityFramework.PowerShell/ConnectionFactoryConfig/ReferenceRemover.cs
  22. +0 −44 src/EntityFramework.PowerShell/ConnectionFactoryConfig/SqlCompactConnectionFactoryConfigurator.cs
  23. +0 −3  src/EntityFramework.PowerShell/ConnectionFactoryConfig/SqlServerDetector.cs
  24. +13 −5 src/EntityFramework.PowerShell/EntityFramework.PowerShell.csproj
  25. +7 −1 src/EntityFramework.PowerShell/Migrations/EnableMigrationsCommand.cs
  26. +12 −17 src/EntityFramework.PowerShell/Migrations/MigrationsDomainCommand.cs
  27. +21 −30 src/EntityFramework.PowerShell/Migrations/UpdateDatabaseCommand.cs
  28. +52 −15 src/EntityFramework.SqlServer/DefaultSqlExecutionStrategy.cs
  29. +27 −12 src/EntityFramework.SqlServer/EntityFramework.SqlServer.csproj
  30. +9 −0 src/EntityFramework.SqlServer/GlobalSuppressions.cs
  31. +52 −9 src/EntityFramework.SqlServer/Properties/Resources.SqlServer.cs
  32. +15 −2 src/EntityFramework.SqlServer/Properties/Resources.SqlServer.resx
  33. +7 −8 src/EntityFramework.SqlServer/Properties/Resources.SqlServer.tt
  34. +10 −0 src/EntityFramework.SqlServer/ServerType.cs
  35. +0 −34 src/EntityFramework.SqlServer/SqlAzureDbConfiguration.cs
  36. +6 −5 src/EntityFramework.SqlServer/SqlAzureExecutionStrategy.cs
  37. +24 −37 src/EntityFramework.SqlServer/SqlAzureRetriableExceptionDetector.cs
  38. +0 −55 src/EntityFramework.SqlServer/SqlExecutionStrategyResolver.cs
  39. +519 −422 src/{EntityFramework/Core/Objects/SqlClient → EntityFramework.SqlServer}/SqlFunctions.cs
  40. +363 −0 src/EntityFramework.SqlServer/SqlGen/DmlFunctionSqlGenerator.cs
  41. +119 −45 src/EntityFramework.SqlServer/SqlGen/DmlSqlGenerator.cs
  42. +8 −6 src/EntityFramework.SqlServer/SqlGen/SqlGenerator.cs
  43. +1 −0  src/EntityFramework.SqlServer/SqlProviderManifest.cs
  44. +212 −112 src/EntityFramework.SqlServer/SqlProviderServices.cs
  45. +216 −39 src/{EntityFramework/Migrations/Sql → EntityFramework.SqlServer}/SqlServerMigrationSqlGenerator.cs
  46. +2 −2 src/EntityFramework.SqlServer/SqlSpatialDataReader.cs
  47. +75 −54 src/{EntityFramework/Core/Objects/SqlClient → EntityFramework.SqlServer}/SqlSpatialFunctions.cs
  48. +4 −5 src/EntityFramework.SqlServer/SqlSpatialServices.cs
  49. +0 −33 src/EntityFramework.SqlServer/SqlSpatialServicesForConversions.cs
  50. +13 −2 src/EntityFramework.SqlServer/SqlTypesAssemblyLoader.cs
  51. +31 −1 src/EntityFramework.SqlServer/SqlVersionUtils.cs
  52. +0 −39 src/EntityFramework.SqlServer/Utilities/Check.cs
  53. +0 −21 src/EntityFramework.SqlServer/Utilities/DebugCheck.cs
  54. +24 −6 src/EntityFramework.SqlServerCompact/EntityFramework.SqlServerCompact.csproj
  55. +12 −0 src/EntityFramework.SqlServerCompact/GlobalSuppressions.cs
  56. +3 −3 src/EntityFramework.SqlServerCompact/Properties/AssemblyVersion.cs
  57. +71 −8 src/EntityFramework.SqlServerCompact/Properties/Resources.SqlServerCompact.cs
  58. +18 −1 src/EntityFramework.SqlServerCompact/Properties/Resources.SqlServerCompact.resx
  59. +48 −39 src/EntityFramework.SqlServerCompact/Properties/Resources.SqlServerCompact.tt
  60. +805 −0 src/EntityFramework.SqlServerCompact/SqlCeFunctions.cs
  61. +874 −0 src/EntityFramework.SqlServerCompact/SqlCeMigrationSqlGenerator.cs
  62. +21 −8 src/EntityFramework.SqlServerCompact/SqlCeMultiCommand.cs
  63. +31 −3 src/EntityFramework.SqlServerCompact/SqlCeProviderServices.cs
  64. +39 −20 src/EntityFramework.SqlServerCompact/SqlGen/DmlSqlGenerator.cs
  65. +41 −5 src/EntityFramework.SqlServerCompact/SqlGen/SqlGenerator.cs
  66. +0 −21 src/EntityFramework.SqlServerCompact/Utilities/DebugCheck.cs
  67. +75 −13 src/EntityFramework/Config/AppConfigDependencyResolver.cs
  68. +326 −34 src/EntityFramework/Config/DbConfiguration.cs
  69. +21 −6 src/EntityFramework/Config/DbConfigurationEventArgs.cs
  70. +0 −11 src/EntityFramework/Config/DbConfigurationFinder.cs
  71. +10 −4 src/EntityFramework/Config/DbConfigurationLoader.cs
  72. +42 −15 src/EntityFramework/Config/DbConfigurationManager.cs
  73. +30 −0 src/EntityFramework/Config/DefaultExecutionStrategyResolver.cs
  74. +2 −1  src/EntityFramework/Config/DefaultInvariantNameResolver.cs
  75. +1 −1  src/EntityFramework/Config/DefaultProviderFactoryResolver.cs
  76. +2 −2 src/EntityFramework/Config/DefaultProviderServicesResolver.cs
  77. +58 −8 src/EntityFramework/Config/ExecutionStrategyResolver.cs
  78. +13 −13 src/EntityFramework/Config/IDbDependencyResolver.cs
  79. +34 −16 src/EntityFramework/Config/InternalConfiguration.cs
  80. +2 −1  src/EntityFramework/Config/InvariantNameResolver.cs
  81. +32 −0 src/EntityFramework/Config/NamedDbProviderService.cs
  82. +21 −27 src/EntityFramework/Config/ProviderServicesFactory.cs
  83. +27 −2 src/EntityFramework/Config/ResolverChain.cs
  84. +21 −16 src/EntityFramework/Config/RootDependencyResolver.cs
  85. +19 −5 src/EntityFramework/Config/SingletonDependencyResolver.cs
  86. +0 −65 src/EntityFramework/Config/ThreadLocalDependencyResolver.cs
  87. +2 −1  src/EntityFramework/Core/Common/CommandTrees/BasicExpressionVisitor.cs
  88. +15 −7 src/EntityFramework/Core/Common/CommandTrees/DbAggregate.cs
  89. +16 −26 src/EntityFramework/Core/Common/CommandTrees/DbAndExpression.cs
  90. +24 −25 src/EntityFramework/Core/Common/CommandTrees/DbApplyExpression.cs
  91. +22 −30 src/EntityFramework/Core/Common/CommandTrees/DbArithmeticExpression.cs
  92. +23 −5 src/EntityFramework/Core/Common/CommandTrees/DbBinaryExpression.cs
  93. +41 −24 src/EntityFramework/Core/Common/CommandTrees/DbCaseExpression.cs
  94. +16 −23 src/EntityFramework/Core/Common/CommandTrees/DbCastExpression.cs
  95. +13 −6 src/EntityFramework/Core/Common/CommandTrees/DbCommandTree.cs
  96. +17 −24 src/EntityFramework/Core/Common/CommandTrees/DbComparisonExpression.cs
  97. +18 −26 src/EntityFramework/Core/Common/CommandTrees/DbConstantExpression.cs
  98. +20 −24 src/EntityFramework/Core/Common/CommandTrees/DbCrossJoinExpression.cs
  99. +6 −5 src/EntityFramework/Core/Common/CommandTrees/DbDeleteCommandTree.cs
  100. +16 −23 src/EntityFramework/Core/Common/CommandTrees/DbDerefExpression.cs
  101. +16 −27 src/EntityFramework/Core/Common/CommandTrees/DbDistinctExpression.cs
  102. +16 −27 src/EntityFramework/Core/Common/CommandTrees/DbElementExpression.cs
  103. +16 −23 src/EntityFramework/Core/Common/CommandTrees/DbEntityRefExpression.cs
  104. +16 −26 src/EntityFramework/Core/Common/CommandTrees/DbExceptExpression.cs
  105. +86 −74 src/EntityFramework/Core/Common/CommandTrees/DbExpression.cs
  106. +12 −8 src/EntityFramework/Core/Common/CommandTrees/DbExpressionBinding.cs
  107. +8 −2 src/EntityFramework/Core/Common/CommandTrees/DbExpressionKind.cs
  108. +303 −92 src/EntityFramework/Core/Common/CommandTrees/DbExpressionVisitor.cs
  109. +349 −135 src/EntityFramework/Core/Common/CommandTrees/DbExpressionVisitor_TResultType.cs
  110. +31 −25 src/EntityFramework/Core/Common/CommandTrees/DbFilterExpression.cs
  111. +5 −9 src/EntityFramework/Core/Common/CommandTrees/DbFunctionAggregate.cs
  112. +7 −9 src/EntityFramework/Core/Common/CommandTrees/DbFunctionCommandTree.cs
  113. +22 −27 src/EntityFramework/Core/Common/CommandTrees/DbFunctionExpression.cs
  114. +1 −3 src/EntityFramework/Core/Common/CommandTrees/DbGroupAggregate.cs
  115. +28 −26 src/EntityFramework/Core/Common/CommandTrees/DbGroupByExpression.cs
  116. +25 −16 src/EntityFramework/Core/Common/CommandTrees/DbGroupExpressionBinding.cs
  117. +15 −8 src/EntityFramework/Core/Common/CommandTrees/DbInExpression.cs
  118. +9 −14 src/EntityFramework/Core/Common/CommandTrees/DbInsertCommandTree.cs
  119. +16 −23 src/EntityFramework/Core/Common/CommandTrees/DbIntersectExpression.cs
  120. +16 −23 src/EntityFramework/Core/Common/CommandTrees/DbIsEmptyExpression.cs
  121. +16 −23 src/EntityFramework/Core/Common/CommandTrees/DbIsNullExpression.cs
  122. +18 −26 src/EntityFramework/Core/Common/CommandTrees/DbIsOfExpression.cs
  123. +33 −28 src/EntityFramework/Core/Common/CommandTrees/DbJoinExpression.cs
  124. +242 −222 src/EntityFramework/Core/Common/CommandTrees/DbLambda.cs
  125. +24 −25 src/EntityFramework/Core/Common/CommandTrees/DbLambdaExpression.cs
  126. +43 −32 src/EntityFramework/Core/Common/CommandTrees/DbLikeExpression.cs
  127. +45 −30 src/EntityFramework/Core/Common/CommandTrees/DbLimitExpression.cs
  128. +5 −4 src/EntityFramework/Core/Common/CommandTrees/DbModificationCommandTree.cs
  129. +20 −24 src/EntityFramework/Core/Common/CommandTrees/DbNewInstanceExpression.cs
  130. +16 −26 src/EntityFramework/Core/Common/CommandTrees/DbNotExpression.cs
  131. +16 −23 src/EntityFramework/Core/Common/CommandTrees/DbNullExpression.cs
  132. +18 −26 src/EntityFramework/Core/Common/CommandTrees/DbOfTypeExpression.cs
  133. +16 −26 src/EntityFramework/Core/Common/CommandTrees/DbOrExpression.cs
  134. +18 −26 src/EntityFramework/Core/Common/CommandTrees/DbParameterReferenceExpression.cs
  135. +31 −25 src/EntityFramework/Core/Common/CommandTrees/DbProjectExpression.cs
  136. +36 −32 src/EntityFramework/Core/Common/CommandTrees/DbPropertyExpression.cs
  137. +29 −27 src/EntityFramework/Core/Common/CommandTrees/DbQuantifierExpression.cs
  138. +7 −4 src/EntityFramework/Core/Common/CommandTrees/DbQueryCommandTree.cs
  139. +18 −26 src/EntityFramework/Core/Common/CommandTrees/DbRefExpression.cs
  140. +15 −20 src/EntityFramework/Core/Common/CommandTrees/DbRefKeyExpression.cs
  141. +36 −33 src/EntityFramework/Core/Common/CommandTrees/DbRelationshipNavigationExpression.cs
  142. +17 −23 src/EntityFramework/Core/Common/CommandTrees/DbScanExpression.cs
  143. +9 −11 src/EntityFramework/Core/Common/CommandTrees/DbSetClause.cs
  144. +42 −26 src/EntityFramework/Core/Common/CommandTrees/DbSkipExpression.cs
  145. +12 −8 src/EntityFramework/Core/Common/CommandTrees/DbSortClause.cs
  146. +28 −25 src/EntityFramework/Core/Common/CommandTrees/DbSortExpression.cs
  147. +16 −23 src/EntityFramework/Core/Common/CommandTrees/DbTreatExpression.cs
  148. +12 −4 src/EntityFramework/Core/Common/CommandTrees/DbUnaryExpression.cs
  149. +15 −20 src/EntityFramework/Core/Common/CommandTrees/DbUnionAllExpression.cs
  150. +13 −28 src/EntityFramework/Core/Common/CommandTrees/DbUpdateCommandTree.cs
  151. +18 −26 src/EntityFramework/Core/Common/CommandTrees/DbVariableReferenceExpression.cs
  152. +201 −16 src/EntityFramework/Core/Common/CommandTrees/DefaultExpressionVisitor.cs
  153. +876 −2,295 src/EntityFramework/Core/Common/CommandTrees/ExpressionBuilder/DbExpressionBuilder.cs
  154. +319 −1,580 src/EntityFramework/Core/Common/CommandTrees/ExpressionBuilder/EdmFunctions.cs
  155. +38 −37 src/EntityFramework/Core/Common/CommandTrees/ExpressionBuilder/Internal/ArgumentValidation.cs
  156. +9 −8 src/EntityFramework/Core/Common/CommandTrees/ExpressionBuilder/Row.cs
  157. +410 −1,978 src/EntityFramework/Core/Common/CommandTrees/ExpressionBuilder/Spatial/SpatialEdmFunctions.cs
  158. +8 −8 src/EntityFramework/Core/Common/CommandTrees/Internal/ExpressionKeyGen.cs
  159. +2 −1  src/EntityFramework/Core/Common/CommandTrees/Internal/ExpressionPrinter.cs
  160. +48 −48 src/EntityFramework/Core/Common/CommandTrees/Internal/Patterns.cs
  161. +21 −6 src/EntityFramework/Core/Common/DataRecordInfo.cs
  162. +11 −6 src/EntityFramework/Core/Common/DbCommandDefinition.cs
  163. +33 −55 src/EntityFramework/Core/Common/DbProviderManifest.cs
  164. +299 −106 src/EntityFramework/Core/Common/DbProviderServices.cs
  165. +27 −9 src/EntityFramework/Core/Common/DbXmlEnabledProviderManifest.cs
  166. +17 −4 src/EntityFramework/Core/Common/EntityRecordInfo.cs
  167. +775 −775 src/EntityFramework/Core/Common/EntitySql/CqlLexer.cs
  168. +5 −5 src/EntityFramework/Core/Common/EntitySql/CqlLexerHelpers.cs
  169. +11 −11 src/EntityFramework/Core/Common/EntitySql/CqlQuery.cs
  170. +20 −8 src/EntityFramework/Core/Common/EntitySql/EntitySqlParser.cs
  171. +4 −12 src/EntityFramework/Core/Common/EntitySql/FunctionDefinition.cs
  172. +3 −5 src/EntityFramework/Core/Common/EntitySql/ParseResult.cs
Sorry, we could not display the entire diff because too many files (1,356) changed.
View
4 .gitignore
@@ -21,4 +21,6 @@ EntityFramework.SqlServerCompact.xml
*.REMOTE.*
*.LOCAL.*
StyleCop.Cache
-*.csproj.DotSettings
+*.csproj.DotSettings
+/coverage
+/OpenCoverResults.xml
View
32 .nuget/NuGet.targets
@@ -8,31 +8,31 @@
<!-- Property that enables building a package from a project -->
<BuildPackage Condition=" '$(BuildPackage)' == '' ">false</BuildPackage>
+
+ <!-- Determines if package restore consent is required to restore packages -->
+ <RequireRestoreConsent Condition=" '$(RequireRestoreConsent)' != 'false' ">true</RequireRestoreConsent>
<!-- Download NuGet.exe if it does not already exist -->
<DownloadNuGetExe Condition=" '$(DownloadNuGetExe)' == '' ">true</DownloadNuGetExe>
</PropertyGroup>
<ItemGroup Condition=" '$(PackageSources)' == '' ">
- <!-- Package sources used to restore packages. By default will used the registered sources under %APPDATA%\NuGet\NuGet.Config -->
- <!--
- <PackageSource Include="https://nuget.org/api/v2/" />
- <PackageSource Include="https://my-nuget-source/nuget/" />
- -->
+ <!-- Package sources used to restore packages. By default, registered sources under %APPDATA%\NuGet\NuGet.Config will be used -->
+ <!-- The official NuGet package source (https://nuget.org/api/v2/) will be excluded if package sources are specified and it does not appear in the list -->
+ <PackageSource Include="https://nuget.org/api/v2/" />
+ <PackageSource Include="https://www.myget.org/F/30de4ee06dd54956a82013fa17a3accb/" />
</ItemGroup>
<PropertyGroup Condition=" '$(OS)' == 'Windows_NT'">
<!-- Windows specific commands -->
<NuGetToolsPath>$([System.IO.Path]::Combine($(SolutionDir), ".nuget"))</NuGetToolsPath>
<PackagesConfig>$([System.IO.Path]::Combine($(ProjectDir), "packages.config"))</PackagesConfig>
- <PackagesDir>$([System.IO.Path]::Combine($(SolutionDir), "packages"))</PackagesDir>
</PropertyGroup>
<PropertyGroup Condition=" '$(OS)' != 'Windows_NT'">
<!-- We need to launch nuget.exe with the mono command if we're not on windows -->
<NuGetToolsPath>$(SolutionDir).nuget</NuGetToolsPath>
<PackagesConfig>packages.config</PackagesConfig>
- <PackagesDir>$(SolutionDir)packages</PackagesDir>
</PropertyGroup>
<PropertyGroup>
@@ -44,12 +44,13 @@
<NuGetCommand Condition=" '$(OS)' != 'Windows_NT' ">mono --runtime=v4.0.30319 $(NuGetExePath)</NuGetCommand>
<PackageOutputDir Condition="$(PackageOutputDir) == ''">$(TargetDir.Trim('\\'))</PackageOutputDir>
-
+
+ <RequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</RequireConsentSwitch>
<!-- Commands -->
- <RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" -o "$(PackagesDir)"</RestoreCommand>
+ <RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(RequireConsentSwitch) -solutionDir "$(SolutionDir) "</RestoreCommand>
<BuildCommand>$(NuGetCommand) pack "$(ProjectPath)" -p Configuration=$(Configuration) -o "$(PackageOutputDir)" -symbols</BuildCommand>
- <!-- Make the build depend on restore packages -->
+ <!-- We need to ensure packages are restored prior to assembly resolve -->
<BuildDependsOn Condition="$(RestorePackages) == 'true'">
RestorePackages;
$(BuildDependsOn);
@@ -66,11 +67,16 @@
<!-- Raise an error if we're unable to locate nuget.exe -->
<Error Condition="'$(DownloadNuGetExe)' != 'true' AND !Exists('$(NuGetExePath)')" Text="Unable to locate '$(NuGetExePath)'" />
<SetEnvironmentVariable EnvKey="VisualStudioVersion" EnvValue="$(VisualStudioVersion)" Condition=" '$(VisualStudioVersion)' != '' AND '$(OS)' == 'Windows_NT' " />
- <DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
+ <!--
+ Take advantage of MsBuild's build dependency tracking to make sure that we only ever download nuget.exe once.
+ This effectively acts as a lock that makes sure that the download operation will only happen once and all
+ parallel builds will have to wait for it to complete.
+ -->
+ <MsBuild Targets="_DownloadNuGet" Projects="$(MSBuildThisFileFullPath)" Properties="Configuration=NOT_IMPORTANT" />
</Target>
- <Target Name="EnableRestore">
- <SetEnvironmentVariable EnvKey="EnableNuGetPackageRestore" EnvValue="true" />
+ <Target Name="_DownloadNuGet">
+ <DownloadNuGet OutputFilename="$(NuGetExePath)" Condition=" '$(DownloadNuGetExe)' == 'true' AND !Exists('$(NuGetExePath)')" />
</Target>
<Target Name="RestorePackages" DependsOnTargets="CheckPrerequisites">
View
7 .nuget/packages.config
@@ -0,0 +1,7 @@
+<?xml version="1.0" encoding="utf-8"?>
+<packages>
+ <package id="Microsoft.Web.SkipStrongNames" version="1.0.0" />
+ <package id="OpenCover" version="4.5.1314" />
+ <package id="ReportGenerator" version="1.7.3.0" />
+ <package id="xunit.runners" version="1.9.1" />
+</packages>
View
2  Build.cmd
@@ -1,3 +1,3 @@
@ECHO OFF
-%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\msbuild EF.msbuild /v:minimal /maxcpucount /nodeReuse:false %*
+%SystemRoot%\Microsoft.NET\Framework\v4.0.30319\msbuild "%~dp0\EF.msbuild" /v:minimal /maxcpucount /nodeReuse:false %*
View
96 EF.msbuild
@@ -1,60 +1,93 @@
<?xml version="1.0" encoding="utf-8"?>
<Project ToolsVersion="4.0" DefaultTargets="Package;Test" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-
+
<PropertyGroup>
<Configuration>Release</Configuration>
<Platform>Any CPU</Platform>
<SolutionFile>EntityFramework.sln</SolutionFile>
- <BuildProperties>Platform=$(Platform);RestorePackages=false</BuildProperties>
+ <BuildProperties>Platform=$(Platform)</BuildProperties>
+ <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">$(MSBuildThisFileDirectory)</SolutionDir>
</PropertyGroup>
+ <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
+
<Target Name="Clean">
- <MSBuild Targets="Clean"
- Projects="$(SolutionFile)"
- Properties="Configuration=$(Configuration);$(BuildProperties)"/>
+ <MSBuild Targets="Clean"
+ Projects="$(SolutionFile)"
+ Properties="Configuration=$(Configuration);$(BuildProperties)" />
+ <MSBuild Targets="Clean"
+ Projects="$(SolutionFile)"
+ Properties="Configuration=ReleaseNet40;$(BuildProperties)" />
</Target>
-
- <Target Name="PreRestorePackages">
+
+ <Target Name="RestorePackages">
+ <PropertyGroup>
+ <RequireRestoreConsent>false</RequireRestoreConsent>
+ </PropertyGroup>
<ItemGroup>
- <RestoreCsProjFiles Include="test\EntityFramework\FunctionalTests\*.csproj" />
- <RestoreCsProjFiles Include="test\EntityFramework\FunctionalTests.Transitional\*.csproj" />
+ <RestoreProjFiles Include="src\EntityFramework.SqlServerCompact\*.csproj" />
+ <RestoreProjFiles Include="test\EntityFramework\FunctionalTests\*.csproj" />
+ <RestoreProjFiles Include="test\EntityFramework\FunctionalTests.Transitional\*.csproj" />
+ <RestoreProjFiles Include="test\EntityFramework\UnitTests\*.csproj" />
+ <RestoreProjFiles Include="test\EntityFramework\VBTests\*.vbproj" />
</ItemGroup>
<Message Text="Restoring NuGet packages..." Importance="High" />
- </Target>
-
- <Target Name="RestorePackages" DependsOnTargets="PreRestorePackages">
- <MSBuild Projects="@(RestoreCsProjFiles)" Targets="EnableRestore;RestorePackages" />
+ <MSBuild Projects="@(RestoreProjFiles)" Targets="RestorePackages" Properties="RequireRestoreConsent=$(RequireRestoreConsent)" />
</Target>
- <Target Name="RestorePackagesSafe" DependsOnTargets="PreRestorePackages">
- <MSBuild Projects="@(RestoreCsProjFiles)" Targets="RestorePackages" />
+ <Target Name="RestoreSolutionPackages" DependsOnTargets="CheckPrerequisites" AfterTargets="RestorePackages">
+ <PropertyGroup>
+ <PackagesConfig>$([System.IO.Path]::Combine($(NuGetToolsPath), "packages.config"))</PackagesConfig>
+ <SolutionRequireConsentSwitch Condition=" $(RequireRestoreConsent) == 'true' ">-RequireConsent</SolutionRequireConsentSwitch>
+ <RestoreCommand>$(NuGetCommand) install "$(PackagesConfig)" -source "$(PackageSources)" $(SolutionRequireConsentSwitch) -solutionDir "$(SolutionDir) "</RestoreCommand>
+ </PropertyGroup>
+ <Exec Command="$(RestoreCommand)"
+ LogStandardErrorAsError="true" />
</Target>
-
- <Target Name="Build" DependsOnTargets="RestorePackagesSafe">
- <MSBuild Targets="Build"
+
+ <Target Name="Build">
+ <MSBuild Targets="Build"
Projects="$(SolutionFile)"
Properties="Configuration=$(Configuration);$(BuildProperties);BuildPackages=false" />
+ <MSBuild Targets="Build"
+ Projects="$(SolutionFile)"
+ Properties="Configuration=ReleaseNet40;$(BuildProperties);BuildPackages=false" />
</Target>
- <Target Name="Rebuild" DependsOnTargets="RestorePackagesSafe">
- <MSBuild Targets="Rebuild"
+ <Target Name="Rebuild">
+ <MSBuild Targets="Rebuild"
Projects="$(SolutionFile)"
Properties="Configuration=$(Configuration);$(BuildProperties);BuildPackages=false" />
- <MSBuild Targets="Rebuild"
+ <MSBuild Targets="Rebuild"
Projects="$(SolutionFile)"
Properties="Configuration=ReleaseNet40;$(BuildProperties);BuildPackages=false" />
</Target>
-
- <Target Name="Test" DependsOnTargets="Rebuild">
- <MSBuild Projects="EF.xunit.targets"
+
+ <Target Name="CheckSkipStrongNames" DependsOnTargets="RestoreSolutionPackages">
+ <MSBuild Targets="CheckSkipStrongNames"
+ Projects="tools\EF.skipstrongnames.targets" />
+ </Target>
+
+ <Target Name="EnableSkipStrongNames" DependsOnTargets="RestoreSolutionPackages">
+ <MSBuild Targets="EnableSkipStrongNames"
+ Projects="tools\EF.skipstrongnames.targets" />
+ </Target>
+
+ <Target Name="DisableSkipStrongNames" DependsOnTargets="RestoreSolutionPackages">
+ <MSBuild Targets="DisableSkipStrongNames"
+ Projects="tools\EF.skipstrongnames.targets" />
+ </Target>
+
+ <Target Name="Test" DependsOnTargets="CheckSkipStrongNames;Rebuild">
+ <MSBuild Projects="tools\EF.xunit.targets"
Properties="Configuration=$(Configuration);$(BuildProperties)" />
</Target>
<Target Name="Package" DependsOnTargets="UpdateVersionNumber;Rebuild">
- <MSBuild Targets="Rebuild"
+ <MSBuild Targets="Build"
Projects="src\EntityFramework.PowerShell\EntityFramework.PowerShell.csproj"
Properties="Configuration=$(Configuration);$(BuildProperties);Platform=AnyCPU;InternalsInvisble=true;RunCodeAnalysis=false" />
- <MSBuild Targets="Rebuild"
+ <MSBuild Targets="Build"
Projects="src\EntityFramework.PowerShell\EntityFramework.PowerShell.csproj"
Properties="Configuration=ReleaseNet40;$(BuildProperties);Platform=AnyCPU;InternalsInvisble=true;RunCodeAnalysis=false" />
</Target>
@@ -64,7 +97,7 @@
<DatePart>2$([System.DateTime]::Now.ToString("MMdd"))</DatePart>
<AssemblyVersion>6.0.0.0</AssemblyVersion>
<AssemblyFileVersion>6.0.$(DatePart).$(BUILD_NUMBER)</AssemblyFileVersion>
- <AssemblyInfoVersion>6.0.0-alpha2-$(DatePart)</AssemblyInfoVersion>
+ <AssemblyInfoVersion>6.0.0-beta1-$(DatePart)</AssemblyInfoVersion>
</PropertyGroup>
<ItemGroup>
<Lines Include="using System.Reflection%3b"/>
@@ -76,14 +109,19 @@
Lines="@(Lines)"
Overwrite="true"
Encoding="UTF-8" />
- <XmlPoke XmlInputPath="src\NuGet\EntityFramework\EntityFramework.nuspec"
+ <XmlPoke XmlInputPath="src\NuGet\EntityFramework\EntityFramework.nuspec"
Query="//x:package/x:metadata/x:version"
Value="$(AssemblyInfoVersion)"
Namespaces="&lt;Namespace Prefix='x' Uri='http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd' /&gt;" />
- <XmlPoke XmlInputPath="src\NuGet\EntityFramework.SqlServerCompact\EntityFramework.SqlServerCompact.nuspec"
+ <XmlPoke XmlInputPath="src\NuGet\EntityFramework.SqlServerCompact\EntityFramework.SqlServerCompact.nuspec"
Query="//x:package/x:metadata/x:version"
Value="$(AssemblyInfoVersion)"
Namespaces="&lt;Namespace Prefix='x' Uri='http://schemas.microsoft.com/packaging/2010/07/nuspec.xsd' /&gt;" />
</Target>
+ <Target Name="CodeCoverage" DependsOnTargets="RestoreSolutionPackages;Build">
+ <MSBuild Projects="tools\EF.opencover.targets"
+ Properties="Configuration=$(Configuration);$(BuildProperties)" />
+ </Target>
+
</Project>
View
20 EF.xunit.targets
@@ -1,20 +0,0 @@
-<?xml version="1.0" encoding="utf-8"?>
-<Project ToolsVersion="4.0" DefaultTargets="Xunit" xmlns="http://schemas.microsoft.com/developer/msbuild/2003">
-
- <!-- This is a separate MSBuild file so that we can survive upgrades of the xunit NuGet package
- and also still work with NuGet Package Restore. -->
-
- <ItemGroup>
- <XunitMsBuildRunner Include="packages\**\xunit.runner.msbuild.dll"/>
- </ItemGroup>
-
- <UsingTask TaskName="Xunit.Runner.MSBuild.xunit" AssemblyFile="@(XunitMsBuildRunner)"/>
-
- <Target Name="Xunit">
- <xunit Assembly="test\EntityFramework\UnitTests\bin\$(Configuration)\EntityFramework.UnitTests.dll" Xml="test\EntityFramework\UnitTests\bin\$(Configuration)\EntityFramework.UnitTests.xml" ShadowCopy="true" />
- <xunit Assembly="test\EntityFramework\FunctionalTests\bin\$(Configuration)\EntityFramework.FunctionalTests.dll" Xml="test\EntityFramework\FunctionalTests\bin\$(Configuration)\EntityFramework.FunctionalTests.xml" ShadowCopy="true" />
- <xunit Assembly="test\EntityFramework\FunctionalTests.Transitional\bin\$(Configuration)\EntityFramework.FunctionalTests.Transitional.dll" Xml="test\EntityFramework\FunctionalTests.Transitional\bin\$(Configuration)\EntityFramework.FunctionalTests.Transitional.xml" ShadowCopy="true" />
- <xunit Condition="'$(Configuration)' != 'ReleaseNet40' And '$(Configuration)' != 'DebugNet40'" Assembly="test\EntityFramework\VBTests\bin\$(Configuration)\EntityFramework.VBTests.dll" Xml="test\EntityFramework\VBTests\bin\$(Configuration)\EntityFramework.VBTests.xml" ShadowCopy="true" />
- </Target>
-
-</Project>
View
1  EntityFramework.sln
@@ -27,7 +27,6 @@ EndProject
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "tools", "tools", "{004FD563-72FA-456F-B4F8-011C307C4FDE}"
ProjectSection(SolutionItems) = preProject
src\NuGet\EntityFramework\tools\about_EntityFramework.help.txt = src\NuGet\EntityFramework\tools\about_EntityFramework.help.txt
- src\NuGet\EntityFramework\tools\EntityFramework.PS3.psd1 = src\NuGet\EntityFramework\tools\EntityFramework.PS3.psd1
src\NuGet\EntityFramework\tools\EntityFramework.psd1 = src\NuGet\EntityFramework\tools\EntityFramework.psd1
src\NuGet\EntityFramework\tools\EntityFramework.psm1 = src\NuGet\EntityFramework\tools\EntityFramework.psm1
src\NuGet\EntityFramework\tools\init.ps1 = src\NuGet\EntityFramework\tools\init.ps1
View
124 EntityFramework.sln.DotSettings
@@ -1,63 +1,63 @@
-<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
-
- <s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=EntityFramework/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="EntityFramework"&gt;&lt;HtmlReformatCode&gt;True&lt;/HtmlReformatCode&gt;&lt;CSArrangeThisQualifier&gt;True&lt;/CSArrangeThisQualifier&gt;&lt;CSRemoveCodeRedundancies&gt;True&lt;/CSRemoveCodeRedundancies&gt;&lt;CSUseAutoProperty&gt;True&lt;/CSUseAutoProperty&gt;&lt;CSMakeFieldReadonly&gt;True&lt;/CSMakeFieldReadonly&gt;&lt;CSUseVar&gt;&lt;BehavourStyle&gt;CAN_CHANGE_TO_IMPLICIT&lt;/BehavourStyle&gt;&lt;LocalVariableStyle&gt;ALWAYS_IMPLICIT&lt;/LocalVariableStyle&gt;&lt;ForeachVariableStyle&gt;ALWAYS_IMPLICIT&lt;/ForeachVariableStyle&gt;&lt;/CSUseVar&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;True&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;XMLReformatCode&gt;True&lt;/XMLReformatCode&gt;&lt;CSUpdateFileHeader&gt;True&lt;/CSUpdateFileHeader&gt;&lt;CSharpFormatDocComments&gt;True&lt;/CSharpFormatDocComments&gt;&lt;/Profile&gt;</s:String>
-
- <s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">EntityFramework</s:String>
- <s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">EntityFramework</s:String>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_ARGUMENT/@EntryValue">False</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_PARAMETER/@EntryValue">False</s:Boolean>
- <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_ATTRIBUTE_STYLE/@EntryValue">SEPARATE</s:String>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_CHOP_COMPOUND_DO_EXPRESSION/@EntryValue">True</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_CHOP_COMPOUND_IF_EXPRESSION/@EntryValue">True</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_CHOP_COMPOUND_WHILE_EXPRESSION/@EntryValue">True</s:Boolean>
- <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FIXED_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
- <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FOR_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
- <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FOREACH_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
- <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_IFELSE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
- <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_USING_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
- <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_WHILE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_NESTED_USINGS_STMT/@EntryValue">True</s:Boolean>
- <s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64>
- <s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/LINE_FEED_AT_FILE_END/@EntryValue">True</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_CONSTRUCTOR_INITIALIZER_ON_SAME_LINE/@EntryValue">False</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_LINQ_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_WHILE_ON_NEW_LINE/@EntryValue">True</s:Boolean>
- <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue">LINE_BREAK</s:String>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AROUND_MULTIPLICATIVE_OP/@EntryValue">True</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_TYPEOF_PARENTHESES/@EntryValue">False</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_WITHIN_SINGLE_LINE_ARRAY_INITIALIZER_BRACES/@EntryValue">True</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_DECLARATION_LPAR/@EntryValue">True</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_INVOCATION_LPAR/@EntryValue">True</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_BINARY_OPSIGN/@EntryValue">True</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_FIRST_TYPE_PARAMETER_CONSTRAINT/@EntryValue">True</s:Boolean>
- <s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">140</s:Int64>
- <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_MULTIPLE_TYPE_PARAMEER_CONSTRAINTS_STYLE/@EntryValue">CHOP_ALWAYS</s:String>
- <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_OBJECT_AND_COLLECTION_INITIALIZER_STYLE/@EntryValue">CHOP_ALWAYS</s:String>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/JavaScriptCodeFormatting/JavaScriptFormatOther/ALIGN_MULTIPLE_DECLARATION/@EntryValue">True</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/WrapBeforeAttr/@EntryValue">False</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/WrapInsideText/@EntryValue">True</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/AddImportsToDeepestScope/@EntryValue">True</s:Boolean>
- <s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/QualifiedUsingAtNestedScope/@EntryValue">True</s:Boolean>
- <s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.&#xD;
-</s:String>
- <s:Boolean x:Key="/Default/CodeStyle/Generate/=Constructor/@KeyIndexDefined">True</s:Boolean>
- <s:String x:Key="/Default/CodeStyle/Generate/=Constructor/Options/=XmlDocumentation/@EntryIndexedValue">True</s:String>
- <s:Boolean x:Key="/Default/CodeStyle/Generate/=Equality/@KeyIndexDefined">True</s:Boolean>
- <s:String x:Key="/Default/CodeStyle/Generate/=Equality/Options/=ChangeEquals/@EntryIndexedValue">Side by side</s:String>
- <s:String x:Key="/Default/CodeStyle/Generate/=Equality/Options/=ChangeGetHashCode/@EntryIndexedValue">Side by side</s:String>
- <s:String x:Key="/Default/CodeStyle/Generate/=Equality/Options/=EqualityOperators/@EntryIndexedValue">False</s:String>
- <s:String x:Key="/Default/CodeStyle/Generate/=Equality/Options/=ImplementIEquatable/@EntryIndexedValue">False</s:String>
- <s:String x:Key="/Default/CodeStyle/Generate/=Equality/Options/=XmlDocumentation/@EntryIndexedValue">False</s:String>
- <s:Boolean x:Key="/Default/CodeStyle/Generate/=Implementations/@KeyIndexDefined">True</s:Boolean>
- <s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=WrapInRegion/@EntryIndexedValue">False</s:String>
- <s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=XmlDocumentation/@EntryIndexedValue">False</s:String>
- <s:Boolean x:Key="/Default/CodeStyle/Generate/=Overrides/@KeyIndexDefined">True</s:Boolean>
- <s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=WrapInRegion/@EntryIndexedValue">False</s:String>
- <s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=XmlDocumentation/@EntryIndexedValue">False</s:String>
- <s:Boolean x:Key="/Default/CodeStyle/IntroduceVariableUseVar/UseVarForIntroduceVariableRefactoring/@EntryValue">True</s:Boolean>
- <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/EventHandlerPatternLong/@EntryValue">$object$_On$event$</s:String>
- <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;</s:String>
+<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
+
+ <s:String x:Key="/Default/CodeStyle/CodeCleanup/Profiles/=EntityFramework/@EntryIndexedValue">&lt;?xml version="1.0" encoding="utf-16"?&gt;&lt;Profile name="EntityFramework"&gt;&lt;HtmlReformatCode&gt;True&lt;/HtmlReformatCode&gt;&lt;CSArrangeThisQualifier&gt;True&lt;/CSArrangeThisQualifier&gt;&lt;CSRemoveCodeRedundancies&gt;True&lt;/CSRemoveCodeRedundancies&gt;&lt;CSUseAutoProperty&gt;True&lt;/CSUseAutoProperty&gt;&lt;CSMakeFieldReadonly&gt;True&lt;/CSMakeFieldReadonly&gt;&lt;CSUseVar&gt;&lt;BehavourStyle&gt;CAN_CHANGE_TO_IMPLICIT&lt;/BehavourStyle&gt;&lt;LocalVariableStyle&gt;ALWAYS_IMPLICIT&lt;/LocalVariableStyle&gt;&lt;ForeachVariableStyle&gt;ALWAYS_IMPLICIT&lt;/ForeachVariableStyle&gt;&lt;/CSUseVar&gt;&lt;CSOptimizeUsings&gt;&lt;OptimizeUsings&gt;True&lt;/OptimizeUsings&gt;&lt;EmbraceInRegion&gt;False&lt;/EmbraceInRegion&gt;&lt;RegionName&gt;&lt;/RegionName&gt;&lt;/CSOptimizeUsings&gt;&lt;CSShortenReferences&gt;True&lt;/CSShortenReferences&gt;&lt;CSReformatCode&gt;True&lt;/CSReformatCode&gt;&lt;XMLReformatCode&gt;True&lt;/XMLReformatCode&gt;&lt;CSUpdateFileHeader&gt;True&lt;/CSUpdateFileHeader&gt;&lt;CSharpFormatDocComments&gt;True&lt;/CSharpFormatDocComments&gt;&lt;/Profile&gt;</s:String>
+
+ <s:String x:Key="/Default/CodeStyle/CodeCleanup/RecentlyUsedProfile/@EntryValue">EntityFramework</s:String>
+ <s:String x:Key="/Default/CodeStyle/CodeCleanup/SilentCleanupProfile/@EntryValue">EntityFramework</s:String>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_ARGUMENT/@EntryValue">False</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/ALIGN_MULTILINE_PARAMETER/@EntryValue">False</s:Boolean>
+ <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_ATTRIBUTE_STYLE/@EntryValue">SEPARATE</s:String>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_CHOP_COMPOUND_DO_EXPRESSION/@EntryValue">True</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_CHOP_COMPOUND_IF_EXPRESSION/@EntryValue">True</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_CHOP_COMPOUND_WHILE_EXPRESSION/@EntryValue">True</s:Boolean>
+ <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FIXED_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
+ <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FOR_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
+ <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_FOREACH_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
+ <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_IFELSE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
+ <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_USING_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
+ <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/FORCE_WHILE_BRACES_STYLE/@EntryValue">ALWAYS_ADD</s:String>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/INDENT_NESTED_USINGS_STMT/@EntryValue">True</s:Boolean>
+ <s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_CODE/@EntryValue">1</s:Int64>
+ <s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/KEEP_BLANK_LINES_IN_DECLARATIONS/@EntryValue">1</s:Int64>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/LINE_FEED_AT_FILE_END/@EntryValue">True</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_CONSTRUCTOR_INITIALIZER_ON_SAME_LINE/@EntryValue">False</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_FIELD_ATTRIBUTE_ON_SAME_LINE/@EntryValue">False</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_SIMPLE_LINQ_ON_SINGLE_LINE/@EntryValue">False</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/PLACE_WHILE_ON_NEW_LINE/@EntryValue">True</s:Boolean>
+ <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SIMPLE_EMBEDDED_STATEMENT_STYLE/@EntryValue">LINE_BREAK</s:String>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AFTER_TYPECAST_PARENTHESES/@EntryValue">False</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_AROUND_MULTIPLICATIVE_OP/@EntryValue">True</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_BEFORE_TYPEOF_PARENTHESES/@EntryValue">False</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/SPACE_WITHIN_SINGLE_LINE_ARRAY_INITIALIZER_BRACES/@EntryValue">True</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_DECLARATION_LPAR/@EntryValue">True</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_AFTER_INVOCATION_LPAR/@EntryValue">True</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_BINARY_OPSIGN/@EntryValue">True</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_BEFORE_FIRST_TYPE_PARAMETER_CONSTRAINT/@EntryValue">True</s:Boolean>
+ <s:Int64 x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_LIMIT/@EntryValue">140</s:Int64>
+ <s:String x:Key="/Default/CodeStyle/CodeFormatting/CSharpFormat/WRAP_MULTIPLE_TYPE_PARAMEER_CONSTRAINTS_STYLE/@EntryValue">CHOP_ALWAYS</s:String>
+
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/JavaScriptCodeFormatting/JavaScriptFormatOther/ALIGN_MULTIPLE_DECLARATION/@EntryValue">True</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/WrapBeforeAttr/@EntryValue">False</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CodeFormatting/XmlFormatter/WrapInsideText/@EntryValue">True</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/AddImportsToDeepestScope/@EntryValue">True</s:Boolean>
+ <s:Boolean x:Key="/Default/CodeStyle/CSharpUsing/QualifiedUsingAtNestedScope/@EntryValue">True</s:Boolean>
+ <s:String x:Key="/Default/CodeStyle/FileHeader/FileHeaderText/@EntryValue">Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.&#xD;
+</s:String>
+ <s:Boolean x:Key="/Default/CodeStyle/Generate/=Constructor/@KeyIndexDefined">True</s:Boolean>
+ <s:String x:Key="/Default/CodeStyle/Generate/=Constructor/Options/=XmlDocumentation/@EntryIndexedValue">True</s:String>
+ <s:Boolean x:Key="/Default/CodeStyle/Generate/=Equality/@KeyIndexDefined">True</s:Boolean>
+ <s:String x:Key="/Default/CodeStyle/Generate/=Equality/Options/=ChangeEquals/@EntryIndexedValue">Side by side</s:String>
+ <s:String x:Key="/Default/CodeStyle/Generate/=Equality/Options/=ChangeGetHashCode/@EntryIndexedValue">Side by side</s:String>
+ <s:String x:Key="/Default/CodeStyle/Generate/=Equality/Options/=EqualityOperators/@EntryIndexedValue">False</s:String>
+ <s:String x:Key="/Default/CodeStyle/Generate/=Equality/Options/=ImplementIEquatable/@EntryIndexedValue">False</s:String>
+ <s:String x:Key="/Default/CodeStyle/Generate/=Equality/Options/=XmlDocumentation/@EntryIndexedValue">False</s:String>
+ <s:Boolean x:Key="/Default/CodeStyle/Generate/=Implementations/@KeyIndexDefined">True</s:Boolean>
+ <s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=WrapInRegion/@EntryIndexedValue">False</s:String>
+ <s:String x:Key="/Default/CodeStyle/Generate/=Implementations/Options/=XmlDocumentation/@EntryIndexedValue">False</s:String>
+ <s:Boolean x:Key="/Default/CodeStyle/Generate/=Overrides/@KeyIndexDefined">True</s:Boolean>
+ <s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=WrapInRegion/@EntryIndexedValue">False</s:String>
+ <s:String x:Key="/Default/CodeStyle/Generate/=Overrides/Options/=XmlDocumentation/@EntryIndexedValue">False</s:String>
+ <s:Boolean x:Key="/Default/CodeStyle/IntroduceVariableUseVar/UseVarForIntroduceVariableRefactoring/@EntryValue">True</s:Boolean>
+ <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/EventHandlerPatternLong/@EntryValue">$object$_On$event$</s:String>
+ <s:String x:Key="/Default/CodeStyle/Naming/CSharpNaming/PredefinedNamingRules/=PrivateStaticReadonly/@EntryIndexedValue">&lt;Policy Inspect="True" Prefix="_" Suffix="" Style="aaBb" /&gt;</s:String>
<s:String x:Key="/Default/CodeStyle/Naming/VBNaming/EventHandlerPatternLong/@EntryValue">$object$_On$event$</s:String></wpf:ResourceDictionary>
View
6 src/EntityFramework/Utilities/ByteExtensions.cs → src/Common/ByteExtensions.cs
@@ -1,6 +1,12 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
+#if SQLSERVER
+namespace System.Data.Entity.SqlServer.Utilities
+#elif SQLSERVERCOMPACT
+namespace System.Data.Entity.SqlServerCompact.Utilities
+#else
namespace System.Data.Entity.Utilities
+#endif
{
using System.Collections.Generic;
using System.Globalization;
View
8 ...tityFramework.SqlServerCompact/Utilities/Check.cs → src/Common/Check.cs
@@ -1,8 +1,14 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
+#if SQLSERVER
+namespace System.Data.Entity.SqlServer.Utilities
+#elif SQLSERVERCOMPACT
namespace System.Data.Entity.SqlServerCompact.Utilities
+#else
+namespace System.Data.Entity.Utilities
+#endif
{
- using System.Data.Entity.SqlServerCompact.Resources;
+ using Resources;
internal class Check
{
View
10 src/EntityFramework/Utilities/DatabaseName.cs → src/Common/DatabaseName.cs
@@ -1,8 +1,14 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
+#if SQLSERVER
+namespace System.Data.Entity.SqlServer.Utilities
+#elif SQLSERVERCOMPACT
+namespace System.Data.Entity.SqlServerCompact.Utilities
+#else
namespace System.Data.Entity.Utilities
+#endif
{
- using System.Data.Entity.Resources;
+ using Resources;
using System.Diagnostics;
using System.Diagnostics.CodeAnalysis;
@@ -14,7 +20,7 @@ public static DatabaseName Parse(string name)
{
DebugCheck.NotEmpty(name);
- var parts = name.Trim().Split(new[] { '.' });
+ var parts = name.Trim().Split('.');
Debug.Assert(parts.Length > 0);
View
6 src/EntityFramework/Utilities/DebugCheck.cs → src/Common/DebugCheck.cs
@@ -1,6 +1,12 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
+#if SQLSERVER
+namespace System.Data.Entity.SqlServer.Utilities
+#elif SQLSERVERCOMPACT
+namespace System.Data.Entity.SqlServerCompact.Utilities
+#else
namespace System.Data.Entity.Utilities
+#endif
{
using System.Diagnostics;
View
6 ...ntityFramework/Utilities/IEnumerableExtensions.cs → src/Common/IEnumerableExtensions.cs
@@ -1,6 +1,12 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
+#if SQLSERVER
+namespace System.Data.Entity.SqlServer.Utilities
+#elif SQLSERVERCOMPACT
+namespace System.Data.Entity.SqlServerCompact.Utilities
+#else
namespace System.Data.Entity.Utilities
+#endif
{
using System.Collections.Generic;
using System.Diagnostics;
View
8 src/EntityFramework/Utilities/StringExtensions.cs → src/Common/StringExtensions.cs
@@ -1,9 +1,15 @@
// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
+#if SQLSERVER
+namespace System.Data.Entity.SqlServer.Utilities
+#elif SQLSERVERCOMPACT
+namespace System.Data.Entity.SqlServerCompact.Utilities
+#else
namespace System.Data.Entity.Utilities
+#endif
{
+ using Resources;
using System.Data.Entity.Migrations;
- using System.Data.Entity.Resources;
using System.Diagnostics;
using System.Globalization;
using System.Text.RegularExpressions;
View
3  src/EntityFramework.PowerShell.Utility/EntityFramework.PowerShell.Utility.csproj
@@ -14,8 +14,6 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\EcmaPublicKey.snk</AssemblyOriginatorKeyFile>
<DelaySign>true</DelaySign>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
@@ -101,7 +99,6 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
View
38 src/EntityFramework.PowerShell/ConnectionFactoryConfig/AddDefaultConnectionFactoryCommand.cs
@@ -0,0 +1,38 @@
+// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
+
+namespace System.Data.Entity.ConnectionFactoryConfig
+{
+ using System.Data.Entity.Migrations;
+ using System.Data.Entity.Utilities;
+ using System.Xml.Linq;
+
+ internal class AddDefaultConnectionFactoryCommand : MigrationsDomainCommand
+ {
+ public AddDefaultConnectionFactoryCommand(string typeName, string[] constructorArguments)
+ {
+ // Using check because this is effecitively public surface since
+ // it is called by a PowerShell command.
+ Check.NotEmpty(typeName, "typeName");
+
+ Execute(() => Execute(typeName, constructorArguments));
+ }
+
+ public void Execute(string typeName, string[] constructorArguments)
+ {
+ DebugCheck.NotEmpty(typeName);
+
+ var manipulator = new ConfigFileManipulator();
+ var processor = new ConfigFileProcessor();
+
+ new ConfigFileFinder().FindConfigFiles(
+ Project.ProjectItems,
+ i => processor.ProcessConfigFile(
+ i, new Func<XDocument, bool>[]
+ {
+ c => manipulator.AddOrUpdateConfigSection(c, GetType().Assembly.GetName().Version),
+ c => manipulator.AddOrUpdateConnectionFactoryInConfig(
+ c, new ConnectionFactorySpecification(typeName, constructorArguments))
+ }));
+ }
+ }
+}
View
39 src/EntityFramework.PowerShell/ConnectionFactoryConfig/AddProviderCommand.cs
@@ -0,0 +1,39 @@
+// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
+
+namespace System.Data.Entity.ConnectionFactoryConfig
+{
+ using System.Data.Entity.Migrations;
+ using System.Data.Entity.Utilities;
+ using System.Xml.Linq;
+
+ internal class AddProviderCommand : MigrationsDomainCommand
+ {
+ public AddProviderCommand(string invariantName, string typeName)
+ {
+ // Using check because this is effecitively public surface since
+ // it is called by a PowerShell command.
+ Check.NotEmpty(invariantName, "invariantName");
+ Check.NotEmpty(typeName, "typeName");
+
+ Execute(() => Execute(invariantName, typeName));
+ }
+
+ public void Execute(string invariantName, string typeName)
+ {
+ DebugCheck.NotEmpty(invariantName);
+ DebugCheck.NotEmpty(typeName);
+
+ var manipulator = new ConfigFileManipulator();
+ var processor = new ConfigFileProcessor();
+
+ new ConfigFileFinder().FindConfigFiles(
+ Project.ProjectItems,
+ i => processor.ProcessConfigFile(
+ i, new Func<XDocument, bool>[]
+ {
+ c => manipulator.AddOrUpdateConfigSection(c, GetType().Assembly.GetName().Version),
+ c => manipulator.AddProviderToConfig(c, invariantName, typeName)
+ }));
+ }
+ }
+}
View
66 src/EntityFramework.PowerShell/ConnectionFactoryConfig/ConfigFileManipulator.cs
@@ -22,6 +22,8 @@ internal class ConfigFileManipulator
public const string ParameterElementName = "parameter";
public const string ConfigSectionsElementName = "configSections";
public const string SectionElementName = "section";
+ public const string ProvidersElementName = "providers";
+ public const string ProviderElementName = "provider";
/// <summary>
/// Checks whether or not the given XML document representing a .config file contains
@@ -75,7 +77,8 @@ public virtual bool AddOrUpdateConnectionFactoryInConfig(XDocument config, Conne
var currentFactoryAttribute = connectionFactoryElement.Attribute("type");
if (currentFactoryAttribute != null
- && specification.ConnectionFactoryName.Equals(currentFactoryAttribute.Value, StringComparison.OrdinalIgnoreCase))
+ && specification.ConnectionFactoryName.Equals(currentFactoryAttribute.Value, StringComparison.OrdinalIgnoreCase)
+ && FactoryArgumentsMatch(connectionFactoryElement, specification))
{
return false;
}
@@ -98,6 +101,67 @@ private void AddFactoryArguments(XElement factoryElement, ConnectionFactorySpeci
}
}
+ private bool FactoryArgumentsMatch(XElement factoryElement, ConnectionFactorySpecification specification)
+ {
+ var parametersElement = factoryElement.Element(ParametersElementName);
+ var currentParameters = parametersElement == null
+ ? new string[0]
+ : parametersElement.Elements(ParameterElementName)
+ .Select(e => e.Attribute("value").Value);
+
+ return currentParameters.SequenceEqual(specification.ConstructorArguments);
+ }
+
+ public virtual bool AddProviderToConfig(XDocument config, string invariantName, string typeName)
+ {
+ DebugCheck.NotNull(config);
+
+ var providersElement = config
+ .GetOrCreateElement(ConfigurationElementName)
+ .GetOrCreateElement(EntityFrameworkElementName)
+ .GetOrCreateElement(ProvidersElementName);
+
+ var invariantAttribute = new XAttribute("invariantName", invariantName);
+ var modificationMade = false;
+
+ // Check if element exists at end
+ var providerElement = providersElement.Elements(ProviderElementName).LastOrDefault();
+ if (providerElement == null
+ || providerElement.Attributes(invariantAttribute.Name).All(a => a.Value != invariantAttribute.Value))
+ {
+ // Check if element exists and if so move it to end
+ providerElement = providersElement
+ .Elements(ProviderElementName)
+ .FirstOrDefault(e => e.Attributes(invariantAttribute.Name).Any(a => a.Value == invariantAttribute.Value));
+
+ if (providerElement != null)
+ {
+ providerElement.Remove();
+ }
+ else
+ {
+ providerElement = new XElement(ProviderElementName, invariantAttribute);
+ }
+
+ providersElement.Add(providerElement);
+ modificationMade = true;
+ }
+
+ var currentTypeAttribute = providerElement.Attribute("type");
+ if (currentTypeAttribute == null)
+ {
+ providerElement.Add(new XAttribute("type", typeName));
+ modificationMade = true;
+ }
+ else if (!typeName.Equals(currentTypeAttribute.Value, StringComparison.OrdinalIgnoreCase))
+ {
+ currentTypeAttribute.Value = typeName;
+ modificationMade = true;
+ }
+
+ return modificationMade;
+ }
+
/// <summary>
/// Ensures that the config file has a defined "entityFramework" section and that it references
/// the current version of the EntityFramework.dll assembly.
View
55 src/EntityFramework.PowerShell/ConnectionFactoryConfig/ConnectionFactoryConfigurator.cs
@@ -1,55 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Data.Entity.ConnectionFactoryConfig
-{
- using System.Data.Entity.Utilities;
- using System.ServiceProcess;
- using System.Xml.Linq;
- using EnvDTE;
- using Microsoft.Win32;
-
- /// <summary>
- /// Handles detection of SQL Server Express or LocalDB on the current machine and adding entries
- /// to .config files of a Visual Studio project to configure the default connection factory acordingly.
- /// </summary>
- public class ConnectionFactoryConfigurator
- {
- /// <summary>
- /// Causes detection of SQL Server Express and/or LocalDB on the current machine and modifies
- /// all "app.config" and "web.config" items in the given project to have an "defaultConnectionFactory"
- /// entry with an appropriate base connection string. If the .config file already contains a
- /// "defaultConnectionFactory" entry then no change is made.
- /// </summary>
- /// <remarks>
- /// This code is usually invoked on installation of the Entity Framework nuget package into a project.
- /// If SQL Express (2005, 2008, or 2012) is found, then SQL Express will be configured.
- /// Otherwise, if a particular version of LocalDB is found, then the connection string will use that version. If
- /// multiple versions are found then an attempt to use the highest version will be made. If no version
- /// of SQL Express or LocalDB is found, then LocalDB v11.0 (SQL Server 2012) will be used.
- /// </remarks>
- /// <param name="project"> The Visual Studio project to configure. </param>
- [CLSCompliant(false)]
- public ConnectionFactoryConfigurator(Project project)
- {
- Check.NotNull(project, "project");
-
- using (
- var detector = new SqlServerDetector(
- Registry.LocalMachine, new ServiceControllerProxy(new ServiceController("MSSQL$SQLEXPRESS"))))
- {
- var factorySpecification = detector.BuildConnectionFactorySpecification();
- var manipulator = new ConfigFileManipulator();
- var processor = new ConfigFileProcessor();
-
- new ConfigFileFinder().FindConfigFiles(
- project.ProjectItems,
- i => processor.ProcessConfigFile(
- i, new Func<XDocument, bool>[]
- {
- c => manipulator.AddOrUpdateConfigSection(c, GetType().Assembly.GetName().Version),
- c => manipulator.AddConnectionFactoryToConfig(c, factorySpecification)
- }));
- }
- }
- }
-}
View
40 src/EntityFramework.PowerShell/ConnectionFactoryConfig/InitializeEntityFrameworkCommand.cs
@@ -0,0 +1,40 @@
+// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
+
+namespace System.Data.Entity.ConnectionFactoryConfig
+{
+ using System.Data.Entity.Migrations;
+ using System.ServiceProcess;
+ using System.Xml.Linq;
+ using Microsoft.Win32;
+
+ internal class InitializeEntityFrameworkCommand : MigrationsDomainCommand
+ {
+ public InitializeEntityFrameworkCommand()
+ {
+ Execute(Execute);
+ }
+
+ public void Execute()
+ {
+ using (
+ var detector = new SqlServerDetector(
+ Registry.LocalMachine, new ServiceControllerProxy(new ServiceController("MSSQL$SQLEXPRESS"))))
+ {
+ var factorySpecification = detector.BuildConnectionFactorySpecification();
+ var manipulator = new ConfigFileManipulator();
+ var processor = new ConfigFileProcessor();
+
+ new ConfigFileFinder().FindConfigFiles(
+ Project.ProjectItems,
+ i => processor.ProcessConfigFile(
+ i, new Func<XDocument, bool>[]
+ {
+ c => manipulator.AddOrUpdateConfigSection(c, GetType().Assembly.GetName().Version),
+ c => manipulator.AddConnectionFactoryToConfig(c, factorySpecification)
+ }));
+ }
+
+ new ReferenceRemover(Project).TryRemoveSystemDataEntity();
+ }
+ }
+}
View
57 src/EntityFramework.PowerShell/ConnectionFactoryConfig/ReferenceRemover.cs
@@ -0,0 +1,57 @@
+// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
+
+namespace System.Data.Entity.ConnectionFactoryConfig
+{
+ using System.Data.Entity.Utilities;
+ using System.Linq;
+ using EnvDTE;
+ using VSLangProj;
+
+ internal class ReferenceRemover
+ {
+ private const string SystemDataEntityIdentity = "System.Data.Entity";
+ private const string SystemDataEntityPublicKeyToken = "b77a5c561934e089";
+
+ private readonly Project _project;
+
+ public ReferenceRemover(Project project)
+ {
+ DebugCheck.NotNull(project);
+
+ _project = project;
+ }
+
+ public void TryRemoveSystemDataEntity()
+ {
+ TryRemoveReference(SystemDataEntityIdentity, SystemDataEntityPublicKeyToken);
+ }
+
+ public void TryRemoveReference(string identity, string publicKeyToken)
+ {
+ DebugCheck.NotEmpty(identity);
+ DebugCheck.NotEmpty(publicKeyToken);
+
+ var reference = TryFindReference(identity, publicKeyToken);
+ if (reference != null)
+ {
+ reference.Remove();
+ }
+ }
+
+ public Reference TryFindReference(string identity, string publicKeyToken)
+ {
+ DebugCheck.NotEmpty(identity);
+ DebugCheck.NotEmpty(publicKeyToken);
+
+ var vsProject = _project.Object as VSProject;
+ return vsProject == null
+ ? null
+ : vsProject.References
+ .OfType<Reference>()
+ .FirstOrDefault(
+ r => r.StrongName
+ && r.Identity == identity
+ && publicKeyToken.Equals(r.PublicKeyToken, StringComparison.OrdinalIgnoreCase));
+ }
+ }
+}
View
44 src/EntityFramework.PowerShell/ConnectionFactoryConfig/SqlCompactConnectionFactoryConfigurator.cs
@@ -1,44 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Data.Entity.ConnectionFactoryConfig
-{
- using System.Data.Entity.Utilities;
- using System.Xml.Linq;
- using EnvDTE;
-
- /// <summary>
- /// Handles adding entries to .config files of a Visual Studio project to configure the
- /// default connection factory to use SQL Server Compact Edition.
- /// </summary>
- public class SqlCompactConnectionFactoryConfigurator
- {
- /// <summary>
- /// Modifies all "app.config" and "web.config" items in the given project to have a
- /// "defaultConnectionFactory" entry specifying the use of SQL Server Compact Edition.
- /// </summary>
- /// <remarks>
- /// This code is usually invoked on installation of the Entity Framework nuget package into a project.
- /// </remarks>
- /// <param name="project"> The Visual Studio project to configure. </param>
- [CLSCompliant(false)]
- public SqlCompactConnectionFactoryConfigurator(Project project)
- {
- DebugCheck.NotNull(project);
-
- var manipulator = new ConfigFileManipulator();
- var processor = new ConfigFileProcessor();
-
- new ConfigFileFinder().FindConfigFiles(
- project.ProjectItems,
- i => processor.ProcessConfigFile(
- i, new Func<XDocument, bool>[]
- {
- c => manipulator.AddOrUpdateConnectionFactoryInConfig(
- c,
- new ConnectionFactorySpecification(
- ConnectionFactorySpecification.SqlCeConnectionFactoryName,
- ConnectionFactorySpecification.SqlCompactProviderName))
- }));
- }
- }
-}
View
3  src/EntityFramework.PowerShell/ConnectionFactoryConfig/SqlServerDetector.cs
@@ -12,9 +12,6 @@ namespace System.Data.Entity.ConnectionFactoryConfig
/// </summary>
internal class SqlServerDetector : IDisposable
{
- public const string BaseConnectionStringTemplate =
- @"Data Source={0}; Integrated Security=True;";
-
private readonly RegistryKeyProxy _localMachine;
private readonly ServiceControllerProxy _controller;
View
18 src/EntityFramework.PowerShell/EntityFramework.PowerShell.csproj
@@ -16,8 +16,6 @@
<DelaySign>true</DelaySign>
<TargetFrameworkProfile />
<BuildPackages>true</BuildPackages>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
@@ -98,6 +96,15 @@
<Isolated>False</Isolated>
<EmbedInteropTypes>False</EmbedInteropTypes>
</COMReference>
+ <COMReference Include="VSLangProj">
+ <Guid>{49a1950e-3e35-4595-8cb9-920c64c44d67}</Guid>
+ <VersionMajor>7</VersionMajor>
+ <VersionMinor>0</VersionMinor>
+ <Lcid>0</Lcid>
+ <WrapperTool>primary</WrapperTool>
+ <Isolated>False</Isolated>
+ <EmbedInteropTypes>False</EmbedInteropTypes>
+ </COMReference>
</ItemGroup>
<ItemGroup>
<Compile Include="..\EntityFramework\Properties\Resources.PowerShell.cs">
@@ -110,14 +117,16 @@
<Link>Properties\SharedAssemblyVersionInfo.cs</Link>
</Compile>
<Compile Include="ConnectionFactoryConfig\ConnectionFactorySpecification.cs" />
+ <Compile Include="ConnectionFactoryConfig\ReferenceRemover.cs" />
+ <Compile Include="ConnectionFactoryConfig\AddDefaultConnectionFactoryCommand.cs" />
+ <Compile Include="ConnectionFactoryConfig\AddProviderCommand.cs" />
+ <Compile Include="ConnectionFactoryConfig\InitializeEntityFrameworkCommand.cs" />
<Compile Include="Migrations\AddMigrationCommand.cs" />
<Compile Include="ConnectionFactoryConfig\ConfigFileFinder.cs" />
<Compile Include="ConnectionFactoryConfig\ConfigFileManipulator.cs" />
<Compile Include="ConnectionFactoryConfig\ConfigFileProcessor.cs" />
- <Compile Include="ConnectionFactoryConfig\ConnectionFactoryConfigurator.cs" />
<Compile Include="ConnectionFactoryConfig\RegistryKeyProxy.cs" />
<Compile Include="ConnectionFactoryConfig\ServiceControllerProxy.cs" />
- <Compile Include="ConnectionFactoryConfig\SqlCompactConnectionFactoryConfigurator.cs" />
<Compile Include="ConnectionFactoryConfig\SqlServerDetector.cs" />
<Compile Include="Migrations\EnableMigrationsCommand.cs" />
<Compile Include="Migrations\Extensions\IEnumerableExtensions.cs" />
@@ -166,5 +175,4 @@
<Target Name="AfterBuild" Condition="$(BuildPackages) == 'true'">
<MSBuild Projects="..\NuGet\NuGet.proj" />
</Target>
- <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
</Project>
View
8 src/EntityFramework.PowerShell/Migrations/EnableMigrationsCommand.cs
@@ -4,6 +4,7 @@ namespace System.Data.Entity.Migrations
{
using System.Collections.Generic;
using System.Data.Entity.Migrations.Extensions;
+ using System.Data.Entity.Migrations.Infrastructure;
using System.Data.Entity.Migrations.Resources;
using System.Data.Entity.Migrations.Utilities;
using System.Data.Entity.Utilities;
@@ -79,6 +80,11 @@ public EnableMigrationsCommand(bool enableAutomaticMigrations, bool force)
tokens["contextType"] = qualifiedContextTypeName.Replace('+', '.');
}
+ if (Path.IsPathRooted(migrationsDirectory))
+ {
+ throw new MigrationsException(Strings.MigrationsDirectoryParamIsRooted(migrationsDirectory));
+ }
+
var path = Path.Combine(migrationsDirectory, fileName);
var absolutePath = Path.Combine(project.GetProjectDir(), path);
@@ -134,7 +140,7 @@ private string FindContextToEnable(string contextTypeName)
// We need to load the users assembly in another AppDomain because you can't reload an assembly
// If the load fails, it will block any further loads of the users assembly in the AppDomain
// If the load succeeds, the loaded assembly is cached and can't be refreshed if the user changes their code and recompiles
- using (var facade = GetFacade())
+ using (var facade = GetFacade(null, useContextWorkingDirectory: true))
{
return facade.GetContextType(contextTypeName);
}
View
29 src/EntityFramework.PowerShell/Migrations/MigrationsDomainCommand.cs
@@ -31,6 +31,11 @@ public Project StartUpProject
get { return (Project)_domain.GetData("startUpProject"); }
}
+ public Project ContextProject
+ {
+ get { return (Project)_domain.GetData("contextProject"); }
+ }
+
protected AppDomain Domain
{
get { return _domain; }
@@ -73,7 +78,7 @@ public void WriteVerbose(string message)
_dispatcher.WriteVerbose(message);
}
- public virtual ToolingFacade GetFacade(string configurationTypeName = null)
+ public virtual ToolingFacade GetFacade(string configurationTypeName = null, bool useContextWorkingDirectory = false)
{
if (configurationTypeName == null)
{
@@ -96,7 +101,8 @@ public virtual ToolingFacade GetFacade(string configurationTypeName = null)
var startUpProject = StartUpProject;
var assemblyName = Project.GetTargetName();
- var workingDirectory = startUpProject.GetTargetDir();
+ var contextAssemblyName = ContextProject.GetTargetName();
+ var workingDirectory = useContextWorkingDirectory ? ContextProject.GetTargetDir() : Project.GetTargetDir();
string configurationFile;
string dataDirectory = null;
@@ -115,6 +121,7 @@ public virtual ToolingFacade GetFacade(string configurationTypeName = null)
return new ToolingFacade(
assemblyName,
+ contextAssemblyName,
configurationTypeName,
workingDirectory,
configurationFile,
@@ -145,21 +152,9 @@ private void Throw(Exception ex)
DebugCheck.NotNull(ex);
_domain.SetData("wasError", true);
-
- var toolEx = ex as ToolingException;
-
- if (toolEx == null)
- {
- _domain.SetData("error.Message", ex.Message);
- _domain.SetData("error.TypeName", ex.GetType().FullName);
- _domain.SetData("error.StackTrace", ex.ToString());
- }
- else
- {
- _domain.SetData("error.Message", toolEx.Message);
- _domain.SetData("error.TypeName", toolEx.InnerType);
- _domain.SetData("error.StackTrace", toolEx.InnerStackTrace);
- }
+ _domain.SetData("error.Message", ex.Message);
+ _domain.SetData("error.TypeName", ex.GetType().FullName);
+ _domain.SetData("error.StackTrace", ex.ToString());
}
}
}
View
51 src/EntityFramework.PowerShell/Migrations/UpdateDatabaseCommand.cs
@@ -2,7 +2,6 @@
namespace System.Data.Entity.Migrations
{
- using System.Data.Entity.Migrations.Design;
using System.Data.Entity.Migrations.Extensions;
using System.Data.Entity.Migrations.Infrastructure;
using System.Data.Entity.Migrations.Resources;
@@ -19,44 +18,36 @@ internal class UpdateDatabaseCommand : MigrationsDomainCommand
Execute(
() =>
+ {
+ var project = Project;
+
+ using (var facade = GetFacade())
{
- var project = Project;
+ if (script)
+ {
+ var sql = facade.ScriptUpdate(sourceMigration, targetMigration, force);
- using (var facade = GetFacade())
+ project.NewSqlFile(sql);
+ }
+ else
{
- if (script)
+ if (!verbose)
{
- var sql = facade.ScriptUpdate(sourceMigration, targetMigration, force);
+ WriteLine(Strings.UpdateDatabaseCommand_VerboseInstructions);
+ }
- project.NewSqlFile(sql);
+ try
+ {
+ facade.Update(targetMigration, force);
}
- else
+ catch (AutomaticMigrationsDisabledException ex)
{
- if (!verbose)
- {
- WriteLine(Strings.UpdateDatabaseCommand_VerboseInstructions);
- }
-
- try
- {
- facade.Update(targetMigration, force);
- }
- catch (ToolingException ex)
- {
- if (ex.InnerType
- == typeof(AutomaticMigrationsDisabledException).FullName)
- {
- facade.LogWarningDelegate(ex.Message);
- facade.LogWarningDelegate(Strings.AutomaticMigrationDisabledInfo);
- }
- else
- {
- throw;
- }
- }
+ facade.LogWarningDelegate(ex.Message);
+ facade.LogWarningDelegate(Strings.AutomaticMigrationDisabledInfo);
}
}
- });
+ }
+ });
}
}
}
View
67 src/EntityFramework.SqlServer/DefaultSqlExecutionStrategy.cs
@@ -9,29 +9,44 @@ namespace System.Data.Entity.SqlServer
using System.Threading.Tasks;
/// <summary>
- /// An execution strategy that doesn't affect the execution but will throw a more helpful exception if a transient failure is detected.
+ /// An <see cref="IExecutionStrategy"/> that doesn't affect the execution but will throw a more helpful exception if a transient failure is detected.
/// </summary>
- internal sealed class DefaultSqlExecutionStrategy : ExecutionStrategy
+ internal sealed class DefaultSqlExecutionStrategy : IExecutionStrategy
{
- public DefaultSqlExecutionStrategy()
- : base(new ExponentialRetryDelayStrategy(), new SqlAzureRetriableExceptionDetector())
+ public bool RetriesOnFailure
{
+ get { return false; }
}
-
- public override bool SupportsExistingTransactions
+
+ public void Execute(Action action)
{
- get { return true; }
+ if (action == null)
+ {
+ throw new ArgumentNullException("action");
+ }
+
+ Execute(
+ () =>
+ {
+ action();
+ return (object)null;
+ });
}
- protected override TResult ProtectedExecute<TResult>(Func<TResult> func)
+ public TResult Execute<TResult>(Func<TResult> func)
{
+ if (func == null)
+ {
+ throw new ArgumentNullException("func");
+ }
+
try
{
return func();
}
catch (Exception ex)
{
- if (RetriableExceptionDetector.ShouldRetryOn(ex))
+ if (ExecutionStrategyBase.UnwrapAndHandleException(ex, SqlAzureRetriableExceptionDetector.ShouldRetryOn))
{
throw new EntityException(Strings.TransientExceptionDetected, ex);
}
@@ -42,16 +57,40 @@ protected override TResult ProtectedExecute<TResult>(Func<TResult> func)
#if !NET40
- protected override async Task<TResult> ProtectedExecuteAsync<TResult>(
- Func<Task<TResult>> taskFunc, CancellationToken cancellationToken)
+ public Task ExecuteAsync(Func<Task> func, CancellationToken cancellationToken)
+ {
+ if (func == null)
+ {
+ throw new ArgumentNullException("func");
+ }
+
+ return ExecuteAsyncImplementation(
+ async () =>
+ {
+ await func().ConfigureAwait(continueOnCapturedContext: false);
+ return true;
+ });
+ }
+
+ public Task<TResult> ExecuteAsync<TResult>(Func<Task<TResult>> func, CancellationToken cancellationToken)
+ {
+ if (func == null)
+ {
+ throw new ArgumentNullException("func");
+ }
+
+ return ExecuteAsyncImplementation(func);
+ }
+
+ private async Task<TResult> ExecuteAsyncImplementation<TResult>(Func<Task<TResult>> func)
{
try
{
- return await taskFunc().ConfigureAwait(continueOnCapturedContext: false);
+ return await func().ConfigureAwait(continueOnCapturedContext: false);
}
catch (Exception ex)
{
- if (RetriableExceptionDetector.ShouldRetryOn(ex))
+ if (ExecutionStrategyBase.UnwrapAndHandleException(ex, SqlAzureRetriableExceptionDetector.ShouldRetryOn))
{
throw new EntityException(Strings.TransientExceptionDetected, ex);
}
@@ -59,8 +98,6 @@ protected override TResult ProtectedExecute<TResult>(Func<TResult> func)
throw;
}
}
-
#endif
-
}
}
View
39 src/EntityFramework.SqlServer/EntityFramework.SqlServer.csproj
@@ -14,8 +14,6 @@
<SignAssembly>true</SignAssembly>
<AssemblyOriginatorKeyFile>..\EcmaPublicKey.snk</AssemblyOriginatorKeyFile>
<DelaySign>true</DelaySign>
- <SolutionDir Condition="$(SolutionDir) == '' Or $(SolutionDir) == '*Undefined*'">..\..\</SolutionDir>
- <RestorePackages>true</RestorePackages>
</PropertyGroup>
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Debug|AnyCPU' ">
<TargetFrameworkVersion>v4.5</TargetFrameworkVersion>
@@ -23,7 +21,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\Debug\</OutputPath>
- <DefineConstants>TRACE;DEBUG</DefineConstants>
+ <DefineConstants>TRACE;DEBUG;SQLSERVER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\EntityFramework.SqlServer.xml</DocumentationFile>
@@ -35,7 +33,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\Release\</OutputPath>
- <DefineConstants>TRACE;CODE_ANALYSIS</DefineConstants>
+ <DefineConstants>TRACE;CODE_ANALYSIS;SQLSERVER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\EntityFramework.SqlServer.xml</DocumentationFile>
@@ -50,7 +48,7 @@
<DebugType>full</DebugType>
<Optimize>false</Optimize>
<OutputPath>bin\DebugNet40\</OutputPath>
- <DefineConstants>TRACE;DEBUG;NET40</DefineConstants>
+ <DefineConstants>TRACE;DEBUG;NET40;SQLSERVER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Debug\EntityFramework.SqlServer.xml</DocumentationFile>
@@ -62,7 +60,7 @@
<DebugType>pdbonly</DebugType>
<Optimize>true</Optimize>
<OutputPath>bin\ReleaseNet40\</OutputPath>
- <DefineConstants>TRACE;CODE_ANALYSIS;NET40</DefineConstants>
+ <DefineConstants>TRACE;CODE_ANALYSIS;NET40;SQLSERVER</DefineConstants>
<ErrorReport>prompt</ErrorReport>
<WarningLevel>4</WarningLevel>
<DocumentationFile>bin\Release\EntityFramework.SqlServer.xml</DocumentationFile>
@@ -88,6 +86,24 @@
<Compile Include="..\SharedAssemblyVersionInfo.cs">
<Link>Properties\SharedAssemblyVersionInfo.cs</Link>
</Compile>
+ <Compile Include="..\Common\ByteExtensions.cs">
+ <Link>Utilities\ByteExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\Common\Check.cs">
+ <Link>Utilities\Check.cs</Link>
+ </Compile>
+ <Compile Include="..\Common\DatabaseName.cs">
+ <Link>Utilities\DatabaseName.cs</Link>
+ </Compile>
+ <Compile Include="..\Common\DebugCheck.cs">
+ <Link>Utilities\DebugCheck.cs</Link>
+ </Compile>
+ <Compile Include="..\Common\IEnumerableExtensions.cs">
+ <Link>Utilities\IEnumerableExtensions.cs</Link>
+ </Compile>
+ <Compile Include="..\Common\StringExtensions.cs">
+ <Link>Utilities\StringExtensions.cs</Link>
+ </Compile>
<Compile Include="DbGeographyAdapter.cs" />
<Compile Include="DbGeometryAdapter.cs" />
<Compile Include="DefaultSqlExecutionStrategy.cs" />
@@ -102,20 +118,20 @@
<DesignTime>True</DesignTime>
<DependentUpon>Resources.SqlServer.tt</DependentUpon>
</Compile>
- <Compile Include="SqlAzureDbConfiguration.cs" />
+ <Compile Include="ServerType.cs" />
<Compile Include="SqlAzureExecutionStrategy.cs" />
<Compile Include="SqlAzureRetriableExceptionDetector.cs" />
<Compile Include="SqlDdlBuilder.cs" />
- <Compile Include="SqlExecutionStrategyResolver.cs" />
+ <Compile Include="SqlFunctions.cs" />
<Compile Include="SqlGen\BoolWrapper.cs" />
+ <Compile Include="SqlGen\DmlFunctionSqlGenerator.cs" />
<Compile Include="SqlGen\DmlSqlGenerator.cs" />
- <Compile Include="SqlSpatialServicesForConversions.cs" />
+ <Compile Include="SqlServerMigrationSqlGenerator.cs" />
+ <Compile Include="SqlSpatialFunctions.cs" />
<Compile Include="SqlTypesAssemblyLoader.cs" />
<Compile Include="SqlVersionUtils.cs" />
- <Compile Include="Utilities\Check.cs" />
<Compile Include="Utilities\SqlDataReaderWrapper.cs" />
<Compile Include="Utilities\DbExpressionExtensions.cs" />
- <Compile Include="Utilities\DebugCheck.cs" />
<Compile Include="Utilities\EdmFunctionExtensions.cs" />
<Compile Include="Utilities\MetdataItemExtensions.cs" />
<Compile Include="Utilities\FuncExtensions.cs" />
@@ -193,7 +209,6 @@
</ProjectReference>
</ItemGroup>
<Import Project="$(MSBuildToolsPath)\Microsoft.CSharp.targets" />
- <Import Project="$(SolutionDir)\.nuget\nuget.targets" />
<!-- To modify your build process, add your task inside one of the targets below and uncomment it.
Other similar extension points exist, see Microsoft.Common.targets.
<Target Name="BeforeBuild">
View
9 src/EntityFramework.SqlServer/GlobalSuppressions.cs
@@ -13,3 +13,12 @@
Target = "System.Data.Entity.SqlServer.SqlSpatialServices.#InitializeMemberInfo()")]
[assembly: SuppressMessage("Microsoft.Design", "CA2210:AssembliesShouldHaveValidStrongNames")]
[assembly: SuppressMessage("Microsoft.Usage", "CA2243:AttributeStringLiteralsShouldParseCorrectly")]
+[assembly:
+ SuppressMessage("Microsoft.Design", "CA1020:AvoidNamespacesWithFewTypes", Scope = "namespace",
+ Target = "System.Data.Entity.Migrations.Sql")]
+[assembly:
+ SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "schemaname", Scope = "resource",
+ Target = "System.Data.Entity.SqlServer.Properties.Resources.SqlServer.resources")]
+[assembly:
+ SuppressMessage("Microsoft.Naming", "CA1703:ResourceStringsShouldBeSpelledCorrectly", MessageId = "objectname", Scope = "resource",
+ Target = "System.Data.Entity.SqlServer.Properties.Resources.SqlServer.resources")]
View
61 src/EntityFramework.SqlServer/Properties/Resources.SqlServer.cs
@@ -1,5 +1,4 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-// <auto-generated />
+// <auto-generated />
namespace System.Data.Entity.SqlServer.Resources
{
@@ -359,12 +358,44 @@ internal static string SqlSpatialservices_CouldNotCreateWellKnownGeometryValueNo
}
/// <summary>
- /// A string like "An exception has been raised that is likely due to a transient failure. If you are connecting to a SQL Azure database consider using the SQL Azure executionStrategy, see SqlAzureDbConfiguration."
+ /// A string like "An exception has been raised that is likely due to a transient failure. If you are connecting to a SQL Azure database consider using SqlAzureExecutionStrategy."
/// </summary>
internal static string TransientExceptionDetected
{
get { return EntityRes.GetString(EntityRes.TransientExceptionDetected); }
}
+
+ /// <summary>
+ /// A string like "This function can only be invoked from LINQ to Entities."
+ /// </summary>
+ internal static string ELinq_DbFunctionDirectCall
+ {
+ get { return EntityRes.GetString(EntityRes.ELinq_DbFunctionDirectCall); }
+ }
+
+ /// <summary>
+ /// A string like "AutomaticMigration"
+ /// </summary>
+ internal static string AutomaticMigration
+ {
+ get { return EntityRes.GetString(EntityRes.AutomaticMigration); }
+ }
+
+ /// <summary>
+ /// A string like "The database name '{0}' is invalid. Database names must be of the form [<schema_name>.]<object_name>."
+ /// </summary>
+ internal static string InvalidDatabaseName(object p0)
+ {
+ return EntityRes.GetString(EntityRes.InvalidDatabaseName, p0);
+ }
+
+ /// <summary>
+ /// A string like "The current migration SQL generator ({0}) is unable to generate SQL for operations of type '{1}'. Call SetSqlGenerator on your migrations configuration class to use a different SQL generator. To create a custom SQL generator that can handle this type of operation, add a new class that derives from {0} and override Generate(MigrationOperation)."
+ /// </summary>
+ internal static string SqlServerMigrationSqlGenerator_UnknownOperation(object p0, object p1)
+ {
+ return EntityRes.GetString(EntityRes.SqlServerMigrationSqlGenerator_UnknownOperation, p0, p1);
+ }
}
/// <summary>
@@ -373,14 +404,22 @@ internal static string TransientExceptionDetected
[GeneratedCode("Resources.SqlServer.tt", "1.0.0.0")]
internal static class Error
{
+
/// <summary>
- /// ArgumentException with message like "The argument '{0}' cannot be null, empty or contain only white space."
+ /// ArgumentException with message like "The database name '{0}' is invalid. Database names must be of the form [<schema_name>.]<object_name>."
/// </summary>
- internal static Exception ArgumentIsNullOrWhitespace(object p0)
+ internal static Exception InvalidDatabaseName(object p0)
{
- return new ArgumentException(Strings.ArgumentIsNullOrWhitespace(p0));
+ return new ArgumentException(Strings.InvalidDatabaseName(p0));
+ }
+
+ /// <summary>
+ /// InvalidOperationException with message like "The current migration SQL generator ({0}) is unable to generate SQL for operations of type '{1}'. Call SetSqlGenerator on your migrations configuration class to use a different SQL generator. To create a custom SQL generator that can handle this type of operation, add a new class that derives from {0} and override Generate(MigrationOperation)."
+ /// </summary>
+ internal static Exception SqlServerMigrationSqlGenerator_UnknownOperation(object p0, object p1)
+ {
+ return new InvalidOperationException(Strings.SqlServerMigrationSqlGenerator_UnknownOperation(p0, p1));
}
-
/// <summary>
/// The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method.
/// </summary>
@@ -458,7 +497,11 @@ internal sealed class EntityRes
internal const string SqlSpatialservices_CouldNotCreateWellKnownGeometryValueNoSrid = "SqlSpatialservices_CouldNotCreateWellKnownGeometryValueNoSrid";
internal const string SqlSpatialservices_CouldNotCreateWellKnownGeometryValueNoWkbOrWkt = "SqlSpatialservices_CouldNotCreateWellKnownGeometryValueNoWkbOrWkt";
internal const string TransientExceptionDetected = "TransientExceptionDetected";
-
+ internal const string ELinq_DbFunctionDirectCall = "ELinq_DbFunctionDirectCall";
+ internal const string AutomaticMigration = "AutomaticMigration";
+ internal const string InvalidDatabaseName = "InvalidDatabaseName";
+ internal const string SqlServerMigrationSqlGenerator_UnknownOperation = "SqlServerMigrationSqlGenerator_UnknownOperation";
+
private static EntityRes loader;
private readonly ResourceManager resources;
@@ -501,7 +544,7 @@ public static string GetString(string name, params object[] args)
if (args != null
&& args.Length > 0)
{
- for (int i = 0; i < args.Length; i ++)
+ for (var i = 0; i < args.Length; i ++)
{
var value = args[i] as String;
if (value != null
View
17 src/EntityFramework.SqlServer/Properties/Resources.SqlServer.resx
@@ -119,7 +119,6 @@
</resheader>
<data name="ArgumentIsNullOrWhitespace" xml:space="preserve">
<value>The argument '{0}' cannot be null, empty or contain only white space.</value>
- <comment>## ExceptionType=ArgumentException</comment>
</data>
<data name="SqlProvider_GeographyValueNotSqlCompatible" xml:space="preserve">
<value>The specified DbGeography value could not be converted to a SQL Server compatible value.</value>
@@ -248,6 +247,20 @@
<value>The specified DbGeometry value did not provide either Well-Known Binary or Well-Known Text.</value>
</data>
<data name="TransientExceptionDetected" xml:space="preserve">
- <value>An exception has been raised that is likely due to a transient failure. If you are connecting to a SQL Azure database consider using the SQL Azure executionStrategy, see SqlAzureDbConfiguration.</value>
+ <value>An exception has been raised that is likely due to a transient failure. If you are connecting to a SQL Azure database consider using SqlAzureExecutionStrategy.</value>
+ </data>
+ <data name="ELinq_DbFunctionDirectCall" xml:space="preserve">
+ <value>This function can only be invoked from LINQ to Entities.</value>
+ </data>
+ <data name="AutomaticMigration" xml:space="preserve">
+ <value>AutomaticMigration</value>
+ </data>
+ <data name="InvalidDatabaseName" xml:space="preserve">
+ <value>The database name '{0}' is invalid. Database names must be of the form [&lt;schema_name&gt;.]&lt;object_name&gt;.</value>
+ <comment>## ExceptionType=ArgumentException</comment>
+ </data>
+ <data name="SqlServerMigrationSqlGenerator_UnknownOperation" xml:space="preserve">
+ <value>The current migration SQL generator ({0}) is unable to generate SQL for operations of type '{1}'. Call SetSqlGenerator on your migrations configuration class to use a different SQL generator. To create a custom SQL generator that can handle this type of operation, add a new class that derives from {0} and override Generate(MigrationOperation).</value>
+ <comment>## ExceptionType=InvalidOperationException</comment>
</data>
</root>
View
15 src/EntityFramework.SqlServer/Properties/Resources.SqlServer.tt
@@ -45,7 +45,6 @@ using (var resxReader = new ResXResourceReader(Path.ChangeExtension(Host.Templat
string outputNamespace = Host.ResolveParameterValue("directiveId", "namespaceDirectiveProcessor", "namespaceHint") ?? string.Empty;
#>
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
// <auto-generated />
namespace <#= outputNamespace #>.Resources
@@ -91,11 +90,12 @@ namespace <#= outputNamespace #>.Resources
/// </summary>
[GeneratedCode("<#= Path.GetFileName(Host.TemplateFile) #>", "1.0.0.0")]
internal static class Error
- {<#
+ {
+<#
foreach (var line in lines.Where(l => l.Item3 != null))
{
#>
-
+
/// <summary>
/// <#= line.Item3 #> with message like "<#= line.Item2 #>"
/// </summary>
@@ -105,7 +105,6 @@ namespace <#= outputNamespace #>.Resources
}
<#
}#>
-
/// <summary>
/// The exception that is thrown when the value of an argument is outside the allowable range of values as defined by the invoked method.
/// </summary>
@@ -139,11 +138,11 @@ namespace <#= outputNamespace #>.Resources
[GeneratedCode("<#= Path.GetFileName(Host.TemplateFile) #>", "1.0.0.0")]
internal sealed class EntityRes
{
- <#
+<#
foreach (var line in lines)
{
- #>internal const string <#= line.Item1 #> = "<#= line.Item1 #>";
- <#
+#> internal const string <#= line.Item1 #> = "<#= line.Item1 #>";
+<#
}
#>
@@ -189,7 +188,7 @@ namespace <#= outputNamespace #>.Resources
if (args != null
&& args.Length > 0)
{
- for (int i = 0; i < args.Length; i ++)
+ for (var i = 0; i < args.Length; i ++)
{
var value = args[i] as String;
if (value != null
View
10 src/EntityFramework.SqlServer/ServerType.cs
@@ -0,0 +1,10 @@
+// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
+
+namespace System.Data.Entity.SqlServer
+{
+ internal enum ServerType
+ {
+ OnPremises,
+ Cloud,
+ }
+}
View
34 src/EntityFramework.SqlServer/SqlAzureDbConfiguration.cs
@@ -1,34 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Data.Entity.SqlServer
-{
- using System.Data.Entity.Config;
- using System.Data.Entity.Infrastructure;
-
- /// <summary>
- /// A class derived from this class can be placed in the same assembly as a class derived from
- /// <see cref="DbContext" /> to enable the SQL Azure retry policy for it.
- /// </summary>
- public class SqlAzureDbConfiguration : DbConfiguration
- {
- /// <summary>
- /// Initializes a new instance of <see cref="SqlAzureDbConfiguration"/> and sets
- /// <see cref="SqlAzureExecutionStrategy"/> as the default execution strategy.
- /// </summary>
- public SqlAzureDbConfiguration()
- {
- AddExecutionStrategy(() => new SqlAzureExecutionStrategy(), null);
- }
-
- /// <summary>
- /// Adds an <see cref="IExecutionStrategy"/> factory method for a particular server name.
- /// The order in which the factories are added is important. The last one takes precedence.
- /// </summary>
- /// <param name="getExecutionStrategy">A function that returns a new instance of an execution strategy.</param>
- /// <param name="serverName">A string that will be matched against the server name in the connection string. <c>null</c> will match anything.</param>
- protected void AddExecutionStrategy(Func<IExecutionStrategy> getExecutionStrategy, string serverName)
- {
- AddDependencyResolver(new SqlExecutionStrategyResolver(getExecutionStrategy, serverName));
- }
- }
-}
View
11 src/EntityFramework.SqlServer/SqlAzureExecutionStrategy.cs
@@ -5,14 +5,15 @@ namespace System.Data.Entity.SqlServer
using System.Data.Entity.Infrastructure;
/// <summary>
- /// An <see cref="ExecutionStrategy"/> that uses the <see cref="ExponentialRetryDelayStrategy"/> and
- /// <see cref="SqlAzureRetriableExceptionDetector"/>.
+ /// An <see cref="IExecutionStrategy"/> that retries actions that throw exceptions caused by SQL Azure transient failures.
/// </summary>
- public class SqlAzureExecutionStrategy : ExecutionStrategy
+ [DbProviderName("System.Data.SqlClient")]
+ public class SqlAzureExecutionStrategy : ExecutionStrategyBase
{
- public SqlAzureExecutionStrategy()
- : base(new ExponentialRetryDelayStrategy(), new SqlAzureRetriableExceptionDetector())
+ /// <inheritdoc/>
+ protected override bool ShouldRetryOn(Exception exception)
{
+ return SqlAzureRetriableExceptionDetector.ShouldRetryOn(exception);
}
}
}
View
61 src/EntityFramework.SqlServer/SqlAzureRetriableExceptionDetector.cs
@@ -2,23 +2,15 @@
namespace System.Data.Entity.SqlServer
{
- using System.Data.Entity.Core;
- using System.Data.Entity.Infrastructure;
using System.Data.SqlClient;
/// <summary>
- /// A <see cref="IRetriableExceptionDetector"/> that detects the exceptions caused by SQL Azure transient failures.
+ /// Detects the exceptions caused by SQL Azure transient failures.
/// </summary>
- public class SqlAzureRetriableExceptionDetector : IRetriableExceptionDetector
+ internal static class SqlAzureRetriableExceptionDetector
{
- /// <inheritdoc/>
- public bool ShouldRetryOn(Exception ex)
+ public static bool ShouldRetryOn(Exception ex)
{
- if (ex == null)
- {
- return false;
- }
-
var sqlException = ex as SqlException;
if (sqlException != null)
{
@@ -31,18 +23,30 @@ public bool ShouldRetryOn(Exception ex)
// Operation on server YYYY and database XXXX is in progress. Please wait a few minutes before trying again.
case 40627:
// SQL Error Code: 40613
- // Database XXXX on server YYYY is not currently available. Please retry the connection later. If the problem persists, contact customer
- // support, and provide them the session tracing ID of ZZZZZ.
+ // Database XXXX on server YYYY is not currently available. Please retry the connection later.
+ // If the problem persists, contact customer support, and provide them the session tracing ID of ZZZZZ.
case 40613:
+ // SQL Error Code: 40545
+ // The service is experiencing a problem that is currently under investigation. Incident ID: %ls. Code: %d.
+ case 40545:
+ // SQL Error Code: 40540
+ // The service has encountered an error processing your request. Please try again.
+ case 40540:
// SQL Error Code: 40501
// The service is currently busy. Retry the request after 10 seconds. Code: (reason code to be decoded).
case 40501:
// SQL Error Code: 40197
// The service has encountered an error processing your request. Please try again.
case 40197:
- // SQL Error Code: 40143
- // The service has encountered an error processing your request. Please try again.
- case 40143:
+ // SQL Error Code: 10929
+ // Resource ID: %d. The %s minimum guarantee is %d, maximum limit is %d and the current usage for the database is %d.
+ // However, the server is currently too busy to support requests greater than %d for this database.
+ // For more information, see http://go.microsoft.com/fwlink/?LinkId=267637. Otherwise, please try again.
+ case 10929:
+ // SQL Error Code: 10928
+ // Resource ID: %d. The %s limit for the database is %d and has been reached. For more information,
+ // see http://go.microsoft.com/fwlink/?LinkId=267637.
+ case 10928:
// SQL Error Code: 10060
// A network-related or instance-specific error occurred while establishing a connection to SQL Server.
// The server was not found or was not accessible. Verify that the instance name is correct and that SQL Server
@@ -60,9 +64,10 @@ public bool ShouldRetryOn(Exception ex)
case 10053:
// SQL Error Code: 233
// The client was unable to establish a connection because of an error during connection initialization process before login.
- // Possible causes include the following: the client tried to connect to an unsupported version of SQL Server; the server was too busy
- // to accept new connections; or there was a resource limitation (insufficient memory or maximum allowed connections) on the server.
- // (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by the remote host.)
+ // Possible causes include the following: the client tried to connect to an unsupported version of SQL Server;
+ // the server was too busy to accept new connections; or there was a resource limitation (insufficient memory or maximum
+ // allowed connections) on the server. (provider: TCP Provider, error: 0 - An existing connection was forcibly closed by
+ // the remote host.)
case 233:
// SQL Error Code: 64
// A connection was successfully established with the server, but then an error occurred during the login process.
@@ -87,24 +92,6 @@ public bool ShouldRetryOn(Exception ex)
return true;
}
- var entityException = ex as EntityException;
- if (entityException != null)
- {
- return ShouldRetryOn(entityException.InnerException);
- }
-
- var dbUpdateException = ex as DbUpdateException;
- if (dbUpdateException != null)
- {
- return ShouldRetryOn(dbUpdateException.InnerException);
- }
-
- var updateException = ex as UpdateException;
- if (updateException != null)
- {
- return ShouldRetryOn(updateException.InnerException);
- }
-
return false;
}
}
View
55 src/EntityFramework.SqlServer/SqlExecutionStrategyResolver.cs
@@ -1,55 +0,0 @@
-// Copyright (c) Microsoft Open Technologies, Inc. All rights reserved. See License.txt in the project root for license information.
-
-namespace System.Data.Entity.SqlServer
-{
- using System.Data.Entity.Config;
- using System.Data.Entity.Infrastructure;
- using System.Data.Entity.SqlServer.Utilities;
-
- public class SqlExecutionStrategyResolver : IDbDependencyResolver
- {
- private readonly Func<IExecutionStrategy> _getExecutionStrategy;
- private readonly string _serverName;
-
- /// <summary>
- /// Initializes a new instance of <see cref="SqlExecutionStrategyResolver"/>
- /// </summary>
- /// <param name="getExecutionStrategy">A function that returns a new instance of an execution strategy.</param>
- /// <param name="serverName">A string that will be matched against the server name in the connection string. <c>null</c> will match anything.</param>
- public SqlExecutionStrategyResolver(Func<IExecutionStrategy> getExecutionStrategy, string serverName)
- {
- Check.NotNull(getExecutionStrategy, "getExecutionStrategy");
-
- _getExecutionStrategy = getExecutionStrategy;
- _serverName = serverName;
- }
-
- public object GetService(Type type, object key)
- {
- if (type == typeof(IExecutionStrategy))
- {
- var executionStrategyKey = key as ExecutionStrategyKey;
- if (executionStrategyKey == null)
- {
- return null;
- }
-
- if (!executionStrategyKey.InvariantProviderName.Equals("System.Data.SqlClient", StringComparison.Ordinal))
- {
- return null;
- }
-
- if (_serverName != null
- &&
- !executionStrategyKey.DataSourceName.Equals(_serverName, StringComparison.Ordinal))
- {
- return null;
- }
-
- return _getExecutionStrategy();
- }
-
- return null;
- }
- }
-}