mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-09-18 17:47:54 +08:00
#19315: Switching to a custom provider when Sql Azure is detected
Work Item: 19315 --HG-- branch : 1.x
This commit is contained in:
26
lib/nhibernate.sqlazure/LICENSE.txt
Normal file
26
lib/nhibernate.sqlazure/LICENSE.txt
Normal file
@@ -0,0 +1,26 @@
|
|||||||
|
Copyright (C) 2012 by Robert Moore
|
||||||
|
|
||||||
|
The source code for NHibernate.SqlAzure is available under an MIT license as
|
||||||
|
per below. If you are using the version of NHibernate.SqlAzure that is combined
|
||||||
|
with the EnterpriseLibrary dlls then it is available under the Microsoft Public
|
||||||
|
License (Ms-PL) as per http://entlib.codeplex.com/license.
|
||||||
|
|
||||||
|
-----
|
||||||
|
|
||||||
|
Permission is hereby granted, free of charge, to any person obtaining a copy
|
||||||
|
of this software and associated documentation files (the "Software"), to deal
|
||||||
|
in the Software without restriction, including without limitation the rights
|
||||||
|
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
||||||
|
copies of the Software, and to permit persons to whom the Software is
|
||||||
|
furnished to do so, subject to the following conditions:
|
||||||
|
|
||||||
|
The above copyright notice and this permission notice shall be included in
|
||||||
|
all copies or substantial portions of the Software.
|
||||||
|
|
||||||
|
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
||||||
|
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
||||||
|
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
||||||
|
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
||||||
|
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
||||||
|
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN
|
||||||
|
THE SOFTWARE.
|
BIN
lib/nhibernate.sqlazure/NHibernate.SqlAzure.dll
Normal file
BIN
lib/nhibernate.sqlazure/NHibernate.SqlAzure.dll
Normal file
Binary file not shown.
BIN
lib/nhibernate.sqlazure/NHibernate.SqlAzure.pdb
Normal file
BIN
lib/nhibernate.sqlazure/NHibernate.SqlAzure.pdb
Normal file
Binary file not shown.
@@ -77,6 +77,9 @@
|
|||||||
<HintPath>..\..\..\lib\newtonsoft.json\Newtonsoft.Json.dll</HintPath>
|
<HintPath>..\..\..\lib\newtonsoft.json\Newtonsoft.Json.dll</HintPath>
|
||||||
<Private>True</Private>
|
<Private>True</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="NHibernate.SqlAzure">
|
||||||
|
<HintPath>..\..\..\lib\nhibernate.sqlazure\NHibernate.SqlAzure.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System">
|
<Reference Include="System">
|
||||||
<Private>False</Private>
|
<Private>False</Private>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
@@ -1,5 +1,6 @@
|
|||||||
using System;
|
using System;
|
||||||
using FluentNHibernate.Cfg.Db;
|
using FluentNHibernate.Cfg.Db;
|
||||||
|
using NHibernate.SqlAzure;
|
||||||
|
|
||||||
namespace Orchard.Data.Providers {
|
namespace Orchard.Data.Providers {
|
||||||
public class SqlServerDataServicesProvider : AbstractDataServicesProvider {
|
public class SqlServerDataServicesProvider : AbstractDataServicesProvider {
|
||||||
@@ -16,11 +17,19 @@ namespace Orchard.Data.Providers {
|
|||||||
}
|
}
|
||||||
|
|
||||||
public override IPersistenceConfigurer GetPersistenceConfigurer(bool createDatabase) {
|
public override IPersistenceConfigurer GetPersistenceConfigurer(bool createDatabase) {
|
||||||
|
|
||||||
var persistence = MsSqlConfiguration.MsSql2008;
|
var persistence = MsSqlConfiguration.MsSql2008;
|
||||||
if (string.IsNullOrEmpty(_connectionString)) {
|
if (string.IsNullOrEmpty(_connectionString)) {
|
||||||
throw new ArgumentException("The connection string is empty");
|
throw new ArgumentException("The connection string is empty");
|
||||||
}
|
}
|
||||||
|
|
||||||
persistence = persistence.ConnectionString(_connectionString);
|
persistence = persistence.ConnectionString(_connectionString);
|
||||||
|
|
||||||
|
// when using Sql Server Azure, use a specific driver, c.f. https://orchard.codeplex.com/workitem/19315
|
||||||
|
if (_connectionString.ToLowerInvariant().Contains("database.windows.net")) {
|
||||||
|
persistence = persistence.Driver<SqlAzureClientDriver>();
|
||||||
|
}
|
||||||
|
|
||||||
return persistence;
|
return persistence;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
@@ -96,6 +96,9 @@
|
|||||||
<SpecificVersion>False</SpecificVersion>
|
<SpecificVersion>False</SpecificVersion>
|
||||||
<HintPath>..\..\lib\nhibernate.linq\NHibernate.Linq.dll</HintPath>
|
<HintPath>..\..\lib\nhibernate.linq\NHibernate.Linq.dll</HintPath>
|
||||||
</Reference>
|
</Reference>
|
||||||
|
<Reference Include="NHibernate.SqlAzure">
|
||||||
|
<HintPath>..\..\lib\nhibernate.sqlazure\NHibernate.SqlAzure.dll</HintPath>
|
||||||
|
</Reference>
|
||||||
<Reference Include="System" />
|
<Reference Include="System" />
|
||||||
<Reference Include="System.ComponentModel.DataAnnotations">
|
<Reference Include="System.ComponentModel.DataAnnotations">
|
||||||
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
<RequiredTargetFramework>3.5</RequiredTargetFramework>
|
||||||
|
Reference in New Issue
Block a user