diff --git a/.gitignore b/.gitignore
index 6fe6ac4255e..8b005b7869f 100644
--- a/.gitignore
+++ b/.gitignore
@@ -12,3 +12,5 @@ current-test-configuration
# to satisfy later build steps. But it should not be committed.
NHibernate.dll
TestResult.xml
+/src/packages
+*.lock.json
diff --git a/Tools/.gitignore b/Tools/.gitignore
index 8ebf927cc77..86eae47e70a 100644
--- a/Tools/.gitignore
+++ b/Tools/.gitignore
@@ -1,2 +1,3 @@
nuget.exe
NUnit.*
+vswhere.*
diff --git a/Tools/msbuild.cmd b/Tools/msbuild.cmd
new file mode 100644
index 00000000000..abdbb860dde
--- /dev/null
+++ b/Tools/msbuild.cmd
@@ -0,0 +1,15 @@
+@echo off
+set MSBuildSDKsPath="C:\Program Files\dotnet\sdk\1.0.1\Sdks"
+
+set pre=Microsoft.VisualStudio.Product.
+set ids=%pre%Community %pre%Professional %pre%Enterprise %pre%BuildTools
+
+for /f "usebackq tokens=1* delims=: " %%i in (`%~dp0\vswhere.1.0.58\tools\vswhere.exe -latest -products %ids% -requires Microsoft.Component.MSBuild`) do (
+ if /i "%%i"=="installationPath" set InstallDir=%%j
+)
+
+if exist "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" (
+ "%InstallDir%\MSBuild\15.0\Bin\MSBuild.exe" %*
+) else (
+ exit /b -1
+)
diff --git a/Tools/packages.config b/Tools/packages.config
index 49fb637eba4..eef69aeea20 100644
--- a/Tools/packages.config
+++ b/Tools/packages.config
@@ -7,4 +7,5 @@
-
\ No newline at end of file
+
+
diff --git a/build-common/common-project.xml b/build-common/common-project.xml
index e51353f4233..e352fd79a48 100644
--- a/build-common/common-project.xml
+++ b/build-common/common-project.xml
@@ -64,9 +64,7 @@
-
-
-
+
diff --git a/src/NHibernate.DomainModel/Compat/NonSerializedAttribute.cs b/src/NHibernate.DomainModel/Compat/NonSerializedAttribute.cs
new file mode 100644
index 00000000000..05107a66013
--- /dev/null
+++ b/src/NHibernate.DomainModel/Compat/NonSerializedAttribute.cs
@@ -0,0 +1,10 @@
+#if !FEATURE_SERIALIZATION && NETSTANDARD
+// ReSharper disable once CheckNamespace
+namespace System
+{
+ [AttributeUsage(AttributeTargets.Field, Inherited = false)]
+ internal sealed class NonSerializedAttribute : Attribute
+ {
+ }
+}
+#endif
diff --git a/src/NHibernate.DomainModel/Compat/SerializableAttribute.cs b/src/NHibernate.DomainModel/Compat/SerializableAttribute.cs
new file mode 100644
index 00000000000..e12a812f14f
--- /dev/null
+++ b/src/NHibernate.DomainModel/Compat/SerializableAttribute.cs
@@ -0,0 +1,10 @@
+#if !FEATURE_SERIALIZATION && NETSTANDARD
+// ReSharper disable once CheckNamespace
+namespace System
+{
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Delegate, Inherited = false)]
+ internal sealed class SerializableAttribute : Attribute
+ {
+ }
+}
+#endif
diff --git a/src/NHibernate.DomainModel/Foo.cs b/src/NHibernate.DomainModel/Foo.cs
index f82739b89a1..d1d9fef1689 100644
--- a/src/NHibernate.DomainModel/Foo.cs
+++ b/src/NHibernate.DomainModel/Foo.cs
@@ -368,7 +368,11 @@ public LifecycleVeto OnSave(ISession s)
_component.Glarch = new Glarch();
_dependent = new Fee();
_dependent.Fi = "belongs to foo # " + Key;
+#if !NETSTANDARD
_locale = Thread.CurrentThread.CurrentCulture;
+#else
+ _locale = CultureInfo.CurrentCulture;
+#endif
return LifecycleVeto.NoVeto;
}
diff --git a/src/NHibernate.DomainModel/Master.cs b/src/NHibernate.DomainModel/Master.cs
index 1a57ca765cc..307582133ba 100644
--- a/src/NHibernate.DomainModel/Master.cs
+++ b/src/NHibernate.DomainModel/Master.cs
@@ -45,7 +45,9 @@ public ISet Details
get { return _details; }
set
{
+#if !NETSTANDARD
Trace.WriteLine("Details assigned");
+#endif
_details = value;
}
}
diff --git a/src/NHibernate.DomainModel/NHSpecific/NullableInt32.cs b/src/NHibernate.DomainModel/NHSpecific/NullableInt32.cs
index b0e0eea2a93..eb468360265 100644
--- a/src/NHibernate.DomainModel/NHSpecific/NullableInt32.cs
+++ b/src/NHibernate.DomainModel/NHSpecific/NullableInt32.cs
@@ -6,7 +6,10 @@ namespace NHibernate.DomainModel.NHSpecific
///
/// A nullable type that wraps an value.
///
- [TypeConverter(typeof(NullableInt32Converter)), Serializable()]
+#if !NETSTANDARD
+ [TypeConverter(typeof(NullableInt32Converter))]
+#endif
+ [Serializable]
public struct NullableInt32 : IFormattable, IComparable
{
public static readonly NullableInt32 Default = new NullableInt32();
diff --git a/src/NHibernate.DomainModel/NHSpecific/NullableInt32Converter.cs b/src/NHibernate.DomainModel/NHSpecific/NullableInt32Converter.cs
index 4075faa8416..fd8c2424a19 100644
--- a/src/NHibernate.DomainModel/NHSpecific/NullableInt32Converter.cs
+++ b/src/NHibernate.DomainModel/NHSpecific/NullableInt32Converter.cs
@@ -1,3 +1,4 @@
+#if !NETSTANDARD
using System;
using System.Collections;
using System.ComponentModel;
@@ -96,4 +97,5 @@ public override bool GetPropertiesSupported(ITypeDescriptorContext context)
return true;
}
}
-}
\ No newline at end of file
+}
+#endif
\ No newline at end of file
diff --git a/src/NHibernate.DomainModel/NHibernate.DomainModel.csproj b/src/NHibernate.DomainModel/NHibernate.DomainModel.csproj
index 6cf42823c26..9029ea60eaa 100644
--- a/src/NHibernate.DomainModel/NHibernate.DomainModel.csproj
+++ b/src/NHibernate.DomainModel/NHibernate.DomainModel.csproj
@@ -1,316 +1,67 @@
-
-
+
+
- Debug
- AnyCPU
- 9.0.30729
- 2.0
- {5C649B55-1B3F-4C38-9998-1B043E94A244}
- Library
- Properties
- NHibernate.DomainModel
+ net461;netstandard1.6
NHibernate.DomainModel
-
-
- 3.5
-
-
- v4.6.1
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
-
+ NHibernate.DomainModel
+ $(PackageTargetFallback);dnxcore50;portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1;portable-net45+wpa81+wp80+win
+ 1.6.1
+ $(PackageTargetFallback);portable-net45+netcore45+wpa81+wp8+MonoAndroid1+MonoTouch1;portable-net45+wpa81+wp80+win
+ false
+ false
+ false
+ false
+ false
-
- true
- full
- false
- bin\Debug-2.0\
- obj\
- obj\Debug-2.0\
- TRACE;DEBUG;NET,NET_2_0
- prompt
- 4
- AllRules.ruleset
- false
+
+
+ $(DefineConstants);NETSTANDARD;FEATURE_DATA_GETCOLUMNSCHEMA;FEATURE_INTERNALIZE_IESI;FEATURE_NETCORE_ICLONEABLE_API;FEATURE_NETCORE_REFLECTION_API
-
- pdbonly
- true
- bin\Release-2.0\
- obj\
- obj\Release-2.0\
- TRACE
- prompt
- 4
- AllRules.ruleset
- false
+
+
+ $(DefineConstants);NET_4_0;FEATURE_ADONET_SQLCOMMANDSET;FEATURE_APPDOMAIN;FEATURE_ASSEMBLYBUILDER_SAVE;FEATURE_BINDINGLIST;FEATURE_CODEDOM;FEATURE_DATA_CLOSE;FEATURE_DATA_GETSCHEMATABLE;FEATURE_DBPROVIDERFACTORIES;FEATURE_ODBC_OLEDB;FEATURE_REFLECTEDTYPE;FEATURE_REMOTING;FEATURE_SECURITY_PERMISSIONS;FEATURE_SERIALIZATION;FEATURE_STRING_INTERN;FEATURE_SYSTEM_CONFIGURATION;FEATURE_SYSTEM_SERVICEMODEL;FEATURE_SYSTEM_TRANSACTIONS;FEATURE_WEB_SESSION_CONTEXT;FEATURE_XML_SCHEMAS;FEATURE_XML_VALIDATIONEVENTHANDLER
+
-
- ..\packages\Iesi.Collections.4.0.1.4000\lib\net40\Iesi.Collections.dll
- True
-
-
-
- 3.5
-
-
-
-
-
-
- SharedAssemblyInfo.cs
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+
+
-
- {5909BFE7-93CF-4E5F-BE22-6293368AF01D}
- NHibernate
-
+
-
-
-
-
-
-
-
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
+
-
-
+
+
+
+
+
+
+
+
+
+
+
+
+
-
+
-
-
-
\ No newline at end of file
+
+
diff --git a/src/NHibernate.Everything.sln b/src/NHibernate.Everything.sln
index efa754ea293..c63018d33bc 100644
--- a/src/NHibernate.Everything.sln
+++ b/src/NHibernate.Everything.sln
@@ -1,7 +1,7 @@
-
+
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25123.0
+# Visual Studio 15
+VisualStudioVersion = 15.0.26114.2
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Support", "Support", "{9BDB5C84-14EC-4384-B423-9E319675B3CA}"
ProjectSection(FolderStartupServices) = postProject
@@ -97,6 +97,10 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "AssemblyInfo", "AssemblyInf
SharedAssemblyInfo.cs = SharedAssemblyInfo.cs
EndProjectSection
EndProject
+Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "NHibernate", "NHibernate", "{A894DB23-2F62-454A-8A98-E95856EE44D2}"
+EndProject
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "backup", "NHibernate\backup\backup.csproj", "{916E69DF-190C-4D84-A249-93803E04387B}"
+EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|.NET = Debug|.NET
@@ -105,6 +109,10 @@ Global
Release|.NET = Release|.NET
Release|Any CPU = Release|Any CPU
Release|Mixed Platforms = Release|Mixed Platforms
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
{5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Debug|.NET.ActiveCfg = Debug|Any CPU
@@ -166,6 +174,18 @@ Global
{7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Release|Any CPU.Build.0 = Release|Any CPU
{7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Release|Mixed Platforms.ActiveCfg = Release|Any CPU
{7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Release|Mixed Platforms.Build.0 = Release|Any CPU
+ {916E69DF-190C-4D84-A249-93803E04387B}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {916E69DF-190C-4D84-A249-93803E04387B}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {916E69DF-190C-4D84-A249-93803E04387B}.Debug|x64.ActiveCfg = Debug|x64
+ {916E69DF-190C-4D84-A249-93803E04387B}.Debug|x64.Build.0 = Debug|x64
+ {916E69DF-190C-4D84-A249-93803E04387B}.Debug|x86.ActiveCfg = Debug|x86
+ {916E69DF-190C-4D84-A249-93803E04387B}.Debug|x86.Build.0 = Debug|x86
+ {916E69DF-190C-4D84-A249-93803E04387B}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {916E69DF-190C-4D84-A249-93803E04387B}.Release|Any CPU.Build.0 = Release|Any CPU
+ {916E69DF-190C-4D84-A249-93803E04387B}.Release|x64.ActiveCfg = Release|x64
+ {916E69DF-190C-4D84-A249-93803E04387B}.Release|x64.Build.0 = Release|x64
+ {916E69DF-190C-4D84-A249-93803E04387B}.Release|x86.ActiveCfg = Release|x86
+ {916E69DF-190C-4D84-A249-93803E04387B}.Release|x86.Build.0 = Release|x86
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
@@ -173,15 +193,12 @@ Global
GlobalSection(NestedProjects) = preSolution
{094F74CD-2DD7-496F-BC48-A6D357BF33FD} = {28EA2C84-8295-49ED-BC67-803B7778513E}
{92509065-DAEA-4457-8300-C7B64CD0E9F4} = {28EA2C84-8295-49ED-BC67-803B7778513E}
- {4CE16C2F-EFF6-48A4-99BC-8984DCC143FA} = {9BDB5C84-14EC-4384-B423-9E319675B3CA}
- {1631B0BA-59AC-4F0D-B300-3F64CC7579C9} = {9BDB5C84-14EC-4384-B423-9E319675B3CA}
- {936E50BD-4027-4864-ADE9-423C3FBF7FFB} = {9BDB5C84-14EC-4384-B423-9E319675B3CA}
{5909BFE7-93CF-4E5F-BE22-6293368AF01D} = {094F74CD-2DD7-496F-BC48-A6D357BF33FD}
{5C649B55-1B3F-4C38-9998-1B043E94A244} = {094F74CD-2DD7-496F-BC48-A6D357BF33FD}
{7AEE5B37-C552-4E59-9B6F-88755BCB5070} = {094F74CD-2DD7-496F-BC48-A6D357BF33FD}
{446E148D-A9D5-4D7D-A706-BEDD45B2BC7D} = {92509065-DAEA-4457-8300-C7B64CD0E9F4}
{7C2EF610-BCA0-4D1F-898A-DE9908E4970C} = {094F74CD-2DD7-496F-BC48-A6D357BF33FD}
- {00C03FBC-6720-4917-A203-DEA12FF3C7BF} = {9BDB5C84-14EC-4384-B423-9E319675B3CA}
+ {916E69DF-190C-4D84-A249-93803E04387B} = {A894DB23-2F62-454A-8A98-E95856EE44D2}
EndGlobalSection
GlobalSection(TextTemplating) = postSolution
TextTemplating = 1
diff --git a/src/NHibernate.Test.VisualBasic/AssemblyInfo.vb b/src/NHibernate.Test.VisualBasic/AssemblyInfo.vb
deleted file mode 100644
index 590f5a4f87c..00000000000
--- a/src/NHibernate.Test.VisualBasic/AssemblyInfo.vb
+++ /dev/null
@@ -1,3 +0,0 @@
-Imports NUnit.Framework
-
-
\ No newline at end of file
diff --git a/src/NHibernate.Test.VisualBasic/My Project/AssemblyInfo.vb b/src/NHibernate.Test.VisualBasic/My Project/AssemblyInfo.vb
index a847091c921..faa706016f3 100644
--- a/src/NHibernate.Test.VisualBasic/My Project/AssemblyInfo.vb
+++ b/src/NHibernate.Test.VisualBasic/My Project/AssemblyInfo.vb
@@ -1,34 +1,36 @@
Imports System
Imports System.Reflection
Imports System.Runtime.InteropServices
+Imports NUnit.Framework
-' General Information about an assembly is controlled through the following
+' General Information about an assembly is controlled through the following
' set of attributes. Change these attribute values to modify the information
' associated with an assembly.
' Review the values of the assembly attributes
-
-
-
-
-
-
+
+
+
+
+
+
'The following GUID is for the ID of the typelib if this project is exposed to COM
-
+
' Version information for an assembly consists of the following four values:
'
' Major Version
-' Minor Version
+' Minor Version
' Build Number
' Revision
'
-' You can specify all the values or you can default the Build and Revision Numbers
+' You can specify all the values or you can default the Build and Revision Numbers
' by using the '*' as shown below:
-'
+'
+
\ No newline at end of file
diff --git a/src/NHibernate.Test.VisualBasic/My Project/Settings.Designer.vb b/src/NHibernate.Test.VisualBasic/My Project/Settings.Designer.vb
index 2886e192c3b..79773042b6d 100644
--- a/src/NHibernate.Test.VisualBasic/My Project/Settings.Designer.vb
+++ b/src/NHibernate.Test.VisualBasic/My Project/Settings.Designer.vb
@@ -15,7 +15,7 @@ Option Explicit On
Namespace My
_
Partial Friend NotInheritable Class MySettings
Inherits Global.System.Configuration.ApplicationSettingsBase
@@ -29,7 +29,7 @@ Namespace My
Private Shared addedHandlerLockObject As New Object
_
- Private Shared Sub AutoSaveSettings(ByVal sender As Global.System.Object, ByVal e As Global.System.EventArgs)
+ Private Shared Sub AutoSaveSettings(sender As Global.System.Object, e As Global.System.EventArgs)
If My.Application.SaveMySettingsOnExit Then
My.Settings.Save()
End If
diff --git a/src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj b/src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj
index f7deb7d8f33..10b866510ce 100644
--- a/src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj
+++ b/src/NHibernate.Test.VisualBasic/NHibernate.Test.VisualBasic.vbproj
@@ -1,23 +1,16 @@

-
+
+
Debug
AnyCPU
-
-
-
-
- {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}
Library
NHibernate.Test.VisualBasic
NHibernate.Test.VisualBasic
512
Windows
v4.6.1
-
- Program
- $(MSBuildProjectDirectory)\..\..\Tools\nunit\nunit-x86.exe
- NHibernate.Test.VisualBasic.dll
true
@@ -27,7 +20,6 @@
bin\Debug\
NHibernate.Test.VisualBasic.xml
42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
- false
pdbonly
@@ -37,7 +29,6 @@
bin\Release\
NHibernate.Test.VisualBasic.xml
42016,41999,42017,42018,42019,42032,42036,42020,42021,42022
- false
On
@@ -52,9 +43,8 @@
On
-
- ..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll
- True
+
+ ..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll
@@ -77,19 +67,18 @@
SharedAssemblyInfo.vb
-
-
-
-
-
-
-
+
-
-
+
+
+
+
+
+
+
True
@@ -115,10 +104,6 @@
-
- App.config
- Designer
-
MyApplicationCodeGenerator
Application.Designer.vb
@@ -130,32 +115,21 @@
+
+
+
+
+
+
- {7AEE5B37-C552-4E59-9B6F-88755BCB5070}
+ {1b7e9512-5b0f-45be-82ad-5ebda404bde3}
NHibernate.Test
- {5909BFE7-93CF-4E5F-BE22-6293368AF01D}
+ {d39e4139-6011-4db2-837e-20c9be221b9c}
NHibernate
-
-
-
-
-
-
-
-
-
-
-
\ No newline at end of file
diff --git a/src/NHibernate.Test.VisualBasic/packages.config b/src/NHibernate.Test.VisualBasic/packages.config
index 1261b7bcffd..4b26cc06617 100644
--- a/src/NHibernate.Test.VisualBasic/packages.config
+++ b/src/NHibernate.Test.VisualBasic/packages.config
@@ -1,4 +1,4 @@

-
+
\ No newline at end of file
diff --git a/src/NHibernate.Test/Any/AnyTypeTest.cs b/src/NHibernate.Test/Any/AnyTypeTest.cs
index d40544ab5e3..bd79668424a 100644
--- a/src/NHibernate.Test/Any/AnyTypeTest.cs
+++ b/src/NHibernate.Test/Any/AnyTypeTest.cs
@@ -1,3 +1,5 @@
+#if FEATURE_SERIALIZATION
+
using System.Collections;
using NUnit.Framework;
@@ -50,4 +52,6 @@ public void FlushProcessing()
session.Close();
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/CfgTest/ConfigurationSerializationTests.cs b/src/NHibernate.Test/CfgTest/ConfigurationSerializationTests.cs
index 7374d70f3c2..b86d82ecf2b 100644
--- a/src/NHibernate.Test/CfgTest/ConfigurationSerializationTests.cs
+++ b/src/NHibernate.Test/CfgTest/ConfigurationSerializationTests.cs
@@ -1,4 +1,6 @@
-using System.IO;
+#if FEATURE_SERIALIZATION
+
+using System.IO;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
using NHibernate.Cfg;
@@ -20,7 +22,7 @@ public void Configuration_should_be_serializable()
[Test]
public void Basic_CRUD_should_work()
{
- Assembly assembly = Assembly.Load("NHibernate.DomainModel");
+ Assembly assembly = Assembly.Load(new AssemblyName("NHibernate.DomainModel"));
var cfg = new Configuration();
if (TestConfigurationHelper.hibernateConfigFile != null)
{
@@ -86,4 +88,6 @@ public void Basic_CRUD_should_work()
export.Drop(true, true);
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/CfgTest/MappingDocumentAggregatorTests.cs b/src/NHibernate.Test/CfgTest/MappingDocumentAggregatorTests.cs
index b10c75e31a5..12a4eb534f4 100644
--- a/src/NHibernate.Test/CfgTest/MappingDocumentAggregatorTests.cs
+++ b/src/NHibernate.Test/CfgTest/MappingDocumentAggregatorTests.cs
@@ -3,12 +3,15 @@
using System.Diagnostics;
using System.IO;
using System.Reflection;
-using System.Runtime.Serialization.Formatters.Binary;
using NHibernate.Cfg.MappingSchema;
using NUnit.Framework;
+#if FEATURE_SERIALIZATION
+using System.Runtime.Serialization.Formatters.Binary;
+#endif
+
namespace NHibernate.Test.CfgTest
{
[TestFixture]
@@ -25,6 +28,7 @@ public void CanAddDomainModelAssembly()
Assert.IsTrue(results.Count > 0); // 54
}
+#if FEATURE_SERIALIZATION
[Test]
public void CanSerializeAndDeserializeDomainModelAssembly()
{
@@ -104,5 +108,6 @@ public void CompareDeserializationTimes()
Console.WriteLine();
}
}
+#endif
}
}
diff --git a/src/NHibernate.Test/ConnectionTest/AggressiveReleaseTest.cs b/src/NHibernate.Test/ConnectionTest/AggressiveReleaseTest.cs
index 1fb7735f136..2239bf8f3ab 100644
--- a/src/NHibernate.Test/ConnectionTest/AggressiveReleaseTest.cs
+++ b/src/NHibernate.Test/ConnectionTest/AggressiveReleaseTest.cs
@@ -43,6 +43,7 @@ protected override void Done()
// Some additional tests specifically for the aggressive-Release functionality...
+#if FEATURE_SERIALIZATION
[Test]
public void SerializationOnAfterStatementAggressiveRelease()
{
@@ -103,6 +104,7 @@ public void SerializationFailsOnAfterStatementAggressiveReleaseWithOpenResources
Release(s);
Done();
}
+#endif
[Test]
public void QueryIteration()
@@ -245,4 +247,4 @@ public void ConnectionMaintanenceDuringFlush()
Done();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs b/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs
index 22aeefc4d76..aecc6690561 100644
--- a/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs
+++ b/src/NHibernate.Test/Criteria/CriteriaQueryTest.cs
@@ -452,6 +452,7 @@ public void CloningCriteria_AddCount_RemoveOrdering()
s.Close();
}
+#if FEATURE_SERIALIZATION
[Test]
public void DetachedCriteriaTest()
{
@@ -489,6 +490,7 @@ public void DetachedCriteriaTest()
t.Commit();
session.Close();
}
+#endif
[Test]
public void SubqueryPaginationOnlyWithFirst()
@@ -3006,4 +3008,4 @@ public void CanSetLockModeOnDetachedCriteria()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/Criteria/DetachedCriteriaSerializable.cs b/src/NHibernate.Test/Criteria/DetachedCriteriaSerializable.cs
index e41eba37c1b..2b9875b9ad9 100644
--- a/src/NHibernate.Test/Criteria/DetachedCriteriaSerializable.cs
+++ b/src/NHibernate.Test/Criteria/DetachedCriteriaSerializable.cs
@@ -1,3 +1,5 @@
+#if FEATURE_SERIALIZATION
+
using System;
using System.Collections;
using NHibernate.Criterion;
@@ -421,4 +423,6 @@ public void ExecutableCriteria()
SerializeAndList(dc);
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/Criteria/Lambda/RestrictionsFixture.cs b/src/NHibernate.Test/Criteria/Lambda/RestrictionsFixture.cs
index 6471c480301..1194d2ccce6 100644
--- a/src/NHibernate.Test/Criteria/Lambda/RestrictionsFixture.cs
+++ b/src/NHibernate.Test/Criteria/Lambda/RestrictionsFixture.cs
@@ -285,8 +285,8 @@ public void FunctionExtensions()
.Add(Restrictions.Eq(Projections.SqlFunction("bit_length", NHibernateUtil.String, Projections.Property("Name")), 32))
.Add(Restrictions.Eq(Projections.SqlFunction("substring", NHibernateUtil.String, Projections.Property("Name"), Projections.Constant(1), Projections.Constant(2)), "te"))
.Add(Restrictions.Eq(Projections.SqlFunction("locate", NHibernateUtil.String, Projections.Constant("e"), Projections.Property("Name"), Projections.Constant(1)), 2))
- .Add(Restrictions.Eq(Projections.SqlFunction("coalesce", NHibernateUtil.Object, Projections.Property("Name"), Projections.Constant("not-null-val")), "test"))
- .Add(Restrictions.Eq(Projections.SqlFunction("coalesce", NHibernateUtil.Object, Projections.Property("NullableIsParent"), Projections.Constant(true)), true))
+ .Add(Restrictions.Eq(Projections.SqlFunction("coalesce", new Type.CoalesceType(), Projections.Property("Name"), Projections.Constant("not-null-val")), "test"))
+ .Add(Restrictions.Eq(Projections.SqlFunction("coalesce", new Type.CoalesceType(), Projections.Property("NullableIsParent"), Projections.Constant(true)), true))
.Add(Restrictions.Eq(Projections.SqlFunction("concat", NHibernateUtil.String, Projections.Property("Name"), Projections.Constant(", "), Projections.Property("Name")), "test, test"))
.Add(Restrictions.Eq(Projections.SqlFunction("mod", NHibernateUtil.Int32, Projections.Property("Height"), Projections.Constant(10)), 0));
@@ -339,4 +339,4 @@ public void FunctionExtensionsProperty()
AssertCriteriaAreEqual(expected, actual);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/DialectTest/SchemaTests/ColumnMetaDataFixture.cs b/src/NHibernate.Test/DialectTest/SchemaTests/ColumnMetaDataFixture.cs
index a8f9d8efa2b..5aea8b70926 100644
--- a/src/NHibernate.Test/DialectTest/SchemaTests/ColumnMetaDataFixture.cs
+++ b/src/NHibernate.Test/DialectTest/SchemaTests/ColumnMetaDataFixture.cs
@@ -12,7 +12,7 @@ public class ColumnMetaDataFixture
private class TestableColumnMetaData : AbstractColumnMetaData
{
public TestableColumnMetaData(DataRow rs, object columnSizeValue, object numericalPrecisionValue)
- : base(rs)
+ : base()
{
SetColumnSize(columnSizeValue);
SetNumericalPrecision(numericalPrecisionValue);
diff --git a/src/NHibernate.Test/DynamicProxyTests/InterfaceProxySerializationTests/ProxyFixture.cs b/src/NHibernate.Test/DynamicProxyTests/InterfaceProxySerializationTests/ProxyFixture.cs
index d9b5badd6d9..4a95bec1ad5 100644
--- a/src/NHibernate.Test/DynamicProxyTests/InterfaceProxySerializationTests/ProxyFixture.cs
+++ b/src/NHibernate.Test/DynamicProxyTests/InterfaceProxySerializationTests/ProxyFixture.cs
@@ -1,9 +1,12 @@
using System;
using System.Collections;
using System.IO;
+using NUnit.Framework;
+
+#if FEATURE_SERIALIZATION
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
-using NUnit.Framework;
+#endif
namespace NHibernate.Test.DynamicProxyTests.InterfaceProxySerializationTests
{
@@ -20,6 +23,7 @@ protected override string MappingsAssembly
get { return "NHibernate.Test"; }
}
+#if FEATURE_SERIALIZATION
private void SerializeAndDeserialize(ref ISession s)
{
// Serialize the session
@@ -36,6 +40,7 @@ private void SerializeAndDeserialize(ref ISession s)
s = (ISession) formatter.Deserialize(stream);
}
}
+#endif
[Test]
public void ExceptionStackTrace()
@@ -92,6 +97,7 @@ public void Proxy()
s.Close();
}
+#if FEATURE_SERIALIZATION
[Test]
public void ProxySerialize()
{
@@ -138,5 +144,6 @@ public void SerializeNotFoundProxy()
Assert.IsNotNull(s.Load(typeof (MyProxyImpl), 5), "should be proxy - even though it doesn't exists in db");
s.Close();
}
+#endif
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/DynamicProxyTests/LazyFieldInterceptorTests.cs b/src/NHibernate.Test/DynamicProxyTests/LazyFieldInterceptorTests.cs
index 70d020796af..5cecfb1f531 100644
--- a/src/NHibernate.Test/DynamicProxyTests/LazyFieldInterceptorTests.cs
+++ b/src/NHibernate.Test/DynamicProxyTests/LazyFieldInterceptorTests.cs
@@ -26,6 +26,9 @@ public void LazyFieldInterceptorMarkedAsSerializable()
Assert.That(typeof(DefaultDynamicLazyFieldInterceptor), Has.Attribute());
}
+#if !FEATURE_SERIALIZATION
+ [Ignore("Requires serializable proxy")]
+#endif
[Test]
public void LazyFieldInterceptorIsBinarySerializable()
{
diff --git a/src/NHibernate.Test/DynamicProxyTests/PeVerifyFixture.cs b/src/NHibernate.Test/DynamicProxyTests/PeVerifyFixture.cs
index d247f4ac75f..e55bd8df991 100644
--- a/src/NHibernate.Test/DynamicProxyTests/PeVerifyFixture.cs
+++ b/src/NHibernate.Test/DynamicProxyTests/PeVerifyFixture.cs
@@ -121,10 +121,10 @@ public SavingProxyAssemblyBuilder(string assemblyName)
this.assemblyName = assemblyName;
}
- public AssemblyBuilder DefineDynamicAssembly(AppDomain appDomain, AssemblyName name)
+ public AssemblyBuilder DefineDynamicAssembly(AssemblyName name)
{
AssemblyBuilderAccess access = AssemblyBuilderAccess.RunAndSave;
- return appDomain.DefineDynamicAssembly(new AssemblyName(assemblyName), access, TestContext.CurrentContext.TestDirectory);
+ return AppDomain.CurrentDomain.DefineDynamicAssembly(new AssemblyName(assemblyName), access, TestContext.CurrentContext.TestDirectory);
}
public ModuleBuilder DefineDynamicModule(AssemblyBuilder assemblyBuilder, string moduleName)
diff --git a/src/NHibernate.Test/Extralazy/ExtraLazyFixture.cs b/src/NHibernate.Test/Extralazy/ExtraLazyFixture.cs
index c9e46da1add..fa7aa62a37f 100644
--- a/src/NHibernate.Test/Extralazy/ExtraLazyFixture.cs
+++ b/src/NHibernate.Test/Extralazy/ExtraLazyFixture.cs
@@ -4,6 +4,9 @@
namespace NHibernate.Test.Extralazy
{
+#if !FEATURE_SERIALIZATION
+ [Ignore("Mapping Document has Serializable type")]
+#endif
[TestFixture]
public class ExtraLazyFixture : TestCase
{
@@ -296,4 +299,4 @@ public void SQLQuery()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/Legacy/FooBarTest.cs b/src/NHibernate.Test/Legacy/FooBarTest.cs
index 5ade062814e..d429c1202cd 100644
--- a/src/NHibernate.Test/Legacy/FooBarTest.cs
+++ b/src/NHibernate.Test/Legacy/FooBarTest.cs
@@ -6,8 +6,6 @@
using System.Diagnostics;
using System.Globalization;
using System.IO;
-using System.Runtime.Serialization;
-using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using Iesi.Collections.Generic;
using NHibernate.Connection;
@@ -19,8 +17,16 @@
using NHibernate.Util;
using NUnit.Framework;
+#if FEATURE_SERIALIZATION
+using System.Runtime.Serialization;
+using System.Runtime.Serialization.Formatters.Binary;
+#endif
+
namespace NHibernate.Test.Legacy
{
+#if !FEATURE_SERIALIZATION
+ [Ignore("Mapping Document has Any type")]
+#endif
[TestFixture]
public class FooBarTest : TestCase
{
@@ -2821,16 +2827,19 @@ public void PersistCollections()
txn.Commit();
s.Disconnect();
+#if FEATURE_SERIALIZATION
// serialize and then deserialize the session.
- Stream stream = new MemoryStream();
IFormatter formatter = new BinaryFormatter();
- formatter.Serialize(stream, s);
+ using (Stream stream = new MemoryStream())
+ {
+ formatter.Serialize(stream, s);
- s.Close();
+ s.Close();
- stream.Position = 0;
- s = (ISession) formatter.Deserialize(stream);
- stream.Close();
+ stream.Position = 0;
+ s = (ISession) formatter.Deserialize(stream);
+ }
+#endif
s.Reconnect();
txn = s.BeginTransaction();
@@ -2869,15 +2878,18 @@ public void PersistCollections()
txn.Commit();
s.Disconnect();
+#if FEATURE_SERIALIZATION
// serialize and then deserialize the session.
- stream = new MemoryStream();
- formatter.Serialize(stream, s);
+ using (MemoryStream stream = new MemoryStream())
+ {
+ formatter.Serialize(stream, s);
- s.Close();
+ s.Close();
- stream.Position = 0;
- s = (ISession) formatter.Deserialize(stream);
- stream.Close();
+ stream.Position = 0;
+ s = (ISession) formatter.Deserialize(stream);
+ }
+#endif
Qux nonexistentQux = (Qux) s.Load(typeof(Qux), (long) 666); //nonexistent
Assert.IsNotNull(nonexistentQux, "even though it doesn't exists should still get a proxy - no db hit.");
@@ -4675,18 +4687,21 @@ public void ProxyArray()
s.Flush();
s.Disconnect();
+#if FEATURE_SERIALIZATION
// serialize the session.
- Stream stream = new MemoryStream();
- IFormatter formatter = new BinaryFormatter();
- formatter.Serialize(stream, s);
+ using (Stream stream = new MemoryStream())
+ {
+ IFormatter formatter = new BinaryFormatter();
+ formatter.Serialize(stream, s);
- // close the original session
- s.Close();
+ // close the original session
+ s.Close();
- // deserialize the session
- stream.Position = 0;
- s = (ISession) formatter.Deserialize(stream);
- stream.Close();
+ // deserialize the session
+ stream.Position = 0;
+ s = (ISession) formatter.Deserialize(stream);
+ }
+#endif
s.Close();
}
@@ -5432,7 +5447,7 @@ public void PSCache()
}
}
- #region NHibernate specific tests
+#region NHibernate specific tests
[Test]
public void Formula()
@@ -5539,6 +5554,6 @@ public void ParameterInOrderByClause()
}
}
- #endregion
+#endregion
}
}
diff --git a/src/NHibernate.Test/Legacy/FumTest.cs b/src/NHibernate.Test/Legacy/FumTest.cs
index 1ba7c5efef1..319b980f191 100644
--- a/src/NHibernate.Test/Legacy/FumTest.cs
+++ b/src/NHibernate.Test/Legacy/FumTest.cs
@@ -2,17 +2,23 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
-using System.Runtime.Serialization.Formatters.Binary;
using NHibernate.DomainModel;
using NHibernate.Criterion;
using NHibernate.Type;
using NUnit.Framework;
+#if FEATURE_SERIALIZATION
+using System.Runtime.Serialization.Formatters.Binary;
+#endif
+
namespace NHibernate.Test.Legacy
{
///
/// FumTest handles testing Composite Ids.
///
+#if !FEATURE_SERIALIZATION
+ [Ignore("Mapping Document has Any type")]
+#endif
[TestFixture]
public class FumTest : TestCase
{
@@ -706,6 +712,7 @@ public void UnflushedSessionSerialization()
private ISession SpoofSerialization(ISession session)
{
+#if FEATURE_SERIALIZATION
BinaryFormatter formatter = new BinaryFormatter();
MemoryStream stream = new MemoryStream();
formatter.Serialize(stream, session);
@@ -713,6 +720,9 @@ private ISession SpoofSerialization(ISession session)
stream.Position = 0;
return (ISession) formatter.Deserialize(stream);
+#else
+ return session;
+#endif
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/Legacy/MasterDetailTest.cs b/src/NHibernate.Test/Legacy/MasterDetailTest.cs
index 003be74765e..9e5bf8f576f 100644
--- a/src/NHibernate.Test/Legacy/MasterDetailTest.cs
+++ b/src/NHibernate.Test/Legacy/MasterDetailTest.cs
@@ -2,7 +2,6 @@
using System.Collections;
using System.Collections.Generic;
using System.IO;
-using System.Runtime.Serialization.Formatters.Binary;
using NHibernate.Dialect;
using NHibernate.DomainModel;
using NHibernate.Engine;
@@ -11,6 +10,10 @@
using NUnit.Framework;
using Single=NHibernate.DomainModel.Single;
+#if FEATURE_SERIALIZATION
+using System.Runtime.Serialization.Formatters.Binary;
+#endif
+
namespace NHibernate.Test.Legacy
{
///
@@ -636,6 +639,7 @@ public void NamedQuery()
s.Close();
}
+#if FEATURE_SERIALIZATION
[Test]
public void Serialization()
{
@@ -658,14 +662,15 @@ public void Serialization()
}
s.Flush();
s.Disconnect();
- MemoryStream stream = new MemoryStream();
BinaryFormatter f = new BinaryFormatter();
- f.Serialize(stream, s);
- stream.Position = 0;
- Console.WriteLine(stream.Length);
+ using (MemoryStream stream = new MemoryStream())
+ {
+ f.Serialize(stream, s);
+ stream.Position = 0;
+ Console.WriteLine(stream.Length);
- s = (ISession) f.Deserialize(stream);
- stream.Close();
+ s = (ISession) f.Deserialize(stream);
+ }
s.Reconnect();
Master m2 = (Master) s.Load(typeof(Master), mid);
@@ -692,12 +697,13 @@ public void Serialization()
object mid2 = s.Save(new Master());
s.Flush();
s.Disconnect();
- stream = new MemoryStream();
- f.Serialize(stream, s);
- stream.Position = 0;
+ using (MemoryStream stream = new MemoryStream())
+ {
+ f.Serialize(stream, s);
+ stream.Position = 0;
- s = (ISession) f.Deserialize(stream);
- stream.Close();
+ s = (ISession) f.Deserialize(stream);
+ }
s.Reconnect();
s.Delete(s.Load(typeof(Master), mid));
@@ -707,23 +713,22 @@ public void Serialization()
s = OpenSession();
string db = s.Connection.Database; //force session to grab a connection
- try
+ using (MemoryStream stream = new MemoryStream())
{
- stream = new MemoryStream();
- f.Serialize(stream, s);
- }
- catch (Exception e)
- {
- Assert.IsTrue(e is InvalidOperationException, "illegal state");
+ try
+ {
+ f.Serialize(stream, s);
+ }
+ catch (Exception e)
+ {
+ Assert.IsTrue(e is InvalidOperationException, "illegal state");
s.Close();
- return;
- }
- finally
- {
- stream.Close();
+ return;
+ }
}
Assert.IsTrue(false, "serialization should have failed");
}
+#endif
[Test]
public void UpdateLazyCollections()
diff --git a/src/NHibernate.Test/Legacy/ParentChildTest.cs b/src/NHibernate.Test/Legacy/ParentChildTest.cs
index fd9b12140ba..343336a69cc 100644
--- a/src/NHibernate.Test/Legacy/ParentChildTest.cs
+++ b/src/NHibernate.Test/Legacy/ParentChildTest.cs
@@ -10,6 +10,9 @@ namespace NHibernate.Test.Legacy
///
/// Summary description for ParentChildTest.
///
+#if !FEATURE_SERIALIZATION
+ [Ignore("Mapping Document has Any type")]
+#endif
[TestFixture]
public class ParentChildTest : TestCase
{
diff --git a/src/NHibernate.Test/Legacy/SQLFunctionsTest.cs b/src/NHibernate.Test/Legacy/SQLFunctionsTest.cs
index 290744e664a..f6d286b85c1 100644
--- a/src/NHibernate.Test/Legacy/SQLFunctionsTest.cs
+++ b/src/NHibernate.Test/Legacy/SQLFunctionsTest.cs
@@ -12,6 +12,9 @@ namespace NHibernate.Test.Legacy
///
/// Summary description for SQLFunctionsTest.
///
+#if !FEATURE_SERIALIZATION
+ [Ignore("Mapping Document has Serializable type")]
+#endif
[TestFixture]
public class SQLFunctionsTest : TestCase
{
diff --git a/src/NHibernate.Test/Linq/LinqReadonlyTestsContext.cs b/src/NHibernate.Test/Linq/LinqReadonlyTestsContext.cs
index 9b53d141e6b..df0cfa597a8 100644
--- a/src/NHibernate.Test/Linq/LinqReadonlyTestsContext.cs
+++ b/src/NHibernate.Test/Linq/LinqReadonlyTestsContext.cs
@@ -114,7 +114,7 @@ private Configuration Configure()
configuration.SetProperty(Environment.ConnectionProvider, typeof (DriverConnectionProvider).AssemblyQualifiedName);
- Assembly assembly = Assembly.Load(MappingsAssembly);
+ Assembly assembly = Assembly.Load(new AssemblyName(MappingsAssembly));
foreach (string file in Mappings.Select(mf => MappingsAssembly + "." + mf))
{
@@ -143,4 +143,4 @@ private void CreateTestData(ISessionFactory sessionFactory)
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/NHSpecificTest/BasicObjectFixture.cs b/src/NHibernate.Test/NHSpecificTest/BasicObjectFixture.cs
index cc6fa666dfb..90b89681955 100644
--- a/src/NHibernate.Test/NHSpecificTest/BasicObjectFixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/BasicObjectFixture.cs
@@ -1,3 +1,5 @@
+#if FEATURE_SERIALIZATION
+
using System;
using System.Collections;
using NHibernate.DomainModel.NHSpecific;
@@ -68,4 +70,6 @@ public void TestCRUD()
s.Close();
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/NHSpecificTest/BasicSerializableFixture.cs b/src/NHibernate.Test/NHSpecificTest/BasicSerializableFixture.cs
index af564197f7a..9a88a328b90 100644
--- a/src/NHibernate.Test/NHSpecificTest/BasicSerializableFixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/BasicSerializableFixture.cs
@@ -1,3 +1,5 @@
+#if FEATURE_SERIALIZATION
+
using System;
using System.Collections;
using NHibernate.DomainModel.NHSpecific;
@@ -79,4 +81,6 @@ public void TestCRUD()
s.Close();
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/NHSpecificTest/Dates/DateTimeOffsetFixture.cs b/src/NHibernate.Test/NHSpecificTest/Dates/DateTimeOffsetFixture.cs
index 1efc88a1127..9e878dbe263 100644
--- a/src/NHibernate.Test/NHSpecificTest/Dates/DateTimeOffsetFixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/Dates/DateTimeOffsetFixture.cs
@@ -2,12 +2,15 @@
using System.Collections;
using System.Data;
using System.IO;
-using System.Runtime.Serialization.Formatters.Binary;
using System.Xml.Serialization;
using NHibernate.Driver;
using NHibernate.Type;
using NUnit.Framework;
+#if FEATURE_SERIALIZATION
+using System.Runtime.Serialization.Formatters.Binary;
+#endif
+
namespace NHibernate.Test.NHSpecificTest.Dates
{
[TestFixture]
@@ -112,6 +115,7 @@ public void DefaultValueDoesNotThrowException()
Assert.That(() => type.DefaultValue, Throws.Nothing);
}
+#if FEATURE_SERIALIZATION
[Test(Description = "NH-3842")]
public void CanBinarySerialize()
{
@@ -121,6 +125,7 @@ public void CanBinarySerialize()
Assert.That(() => formatter.Serialize(Stream.Null, type), Throws.Nothing);
}
+#endif
[Test(Description = "NH-3842")]
public void CanXmlSerialize()
diff --git a/src/NHibernate.Test/NHSpecificTest/DtcFailures/DtcFailuresFixture.cs b/src/NHibernate.Test/NHSpecificTest/DtcFailures/DtcFailuresFixture.cs
index 5f47d850261..06d5bb122fe 100644
--- a/src/NHibernate.Test/NHSpecificTest/DtcFailures/DtcFailuresFixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/DtcFailures/DtcFailuresFixture.cs
@@ -45,7 +45,7 @@ protected override void CreateSchema()
config.BeforeBindMapping += BeforeBindMapping;
// Copied from AddMappings methods.
- Assembly assembly = Assembly.Load(MappingsAssembly);
+ Assembly assembly = Assembly.Load(new AssemblyName(MappingsAssembly));
foreach (string file in Mappings)
config.AddResource(MappingsAssembly + "." + file, assembly);
@@ -353,4 +353,4 @@ public void InDoubt(Enlistment enlistment)
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/NH1274ExportExcludeFixture.cs b/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/NH1274ExportExcludeFixture.cs
index c2f969618de..14a78b0712d 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/NH1274ExportExcludeFixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH1274ExportExclude/NH1274ExportExcludeFixture.cs
@@ -98,7 +98,7 @@ private Configuration GetConfiguration()
if (TestConfigurationHelper.hibernateConfigFile != null)
cfg.Configure(TestConfigurationHelper.hibernateConfigFile);
- Assembly assembly = Assembly.Load(MappingsAssembly);
+ Assembly assembly = Assembly.Load(new AssemblyName(MappingsAssembly));
foreach (string file in Mappings)
{
@@ -133,4 +133,4 @@ protected IList Mappings
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/NHSpecificTest/NH1403/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH1403/Fixture.cs
index a051bca44ea..44ca2002fea 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH1403/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH1403/Fixture.cs
@@ -2,6 +2,9 @@
namespace NHibernate.Test.NHSpecificTest.NH1403
{
+#if !FEATURE_SERIALIZATION
+ [Ignore("Mapping Document has Any type")]
+#endif
[TestFixture]
public class Fixture : BugTestCase
{
@@ -37,4 +40,4 @@ public void Bug()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/NHSpecificTest/NH1421/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH1421/Fixture.cs
index 0814975954f..71576744d9e 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH1421/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH1421/Fixture.cs
@@ -28,6 +28,9 @@ public void WhenParameterListIsEmptyGenericCollectionUsingQueryThenDoesNotTrowsN
}
}
+#if !FEATURE_SERIALIZATION
+ [Ignore("Uses Serializable type")]
+#endif
[Test]
public void WhenParameterListIsEmptyCollectionUsingQueryThenTrowsArgumentException()
{
@@ -60,4 +63,4 @@ public void WhenParameterListIsEmptyUsingQueryThenDoesNotTrowsNullReferenceExcep
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/NHSpecificTest/NH1985/SampleTest.cs b/src/NHibernate.Test/NHSpecificTest/NH1985/SampleTest.cs
index 18c66fd6dcb..00df7ceaca5 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH1985/SampleTest.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH1985/SampleTest.cs
@@ -14,7 +14,7 @@ protected override void OnSetUp()
if (0 == ExecuteStatement("INSERT INTO DomainClass (Id, Label) VALUES (1, 'TEST record');"))
{
- throw new ApplicationException("Insertion of test record failed.");
+ Assert.Fail("Insertion of test record failed.");
}
}
diff --git a/src/NHibernate.Test/NHSpecificTest/NH2297/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH2297/Fixture.cs
index 87a37b2a10c..627248d8489 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH2297/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH2297/Fixture.cs
@@ -24,7 +24,7 @@ public void InvalidCustomCompositeUserTypeThrowsMeaningfulException(
const string mappingsAssembly = "NHibernate.Test";
- Assembly assembly = Assembly.Load(mappingsAssembly);
+ Assembly assembly = Assembly.Load(new AssemblyName(mappingsAssembly));
string ns = GetType().Namespace;
string bugNumber = ns.Substring(ns.LastIndexOf('.') + 1);
diff --git a/src/NHibernate.Test/NHSpecificTest/NH2328/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH2328/Fixture.cs
index a0dcb58b148..53a4fda6dea 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH2328/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH2328/Fixture.cs
@@ -4,6 +4,9 @@
namespace NHibernate.Test.NHSpecificTest.NH2328
{
+#if !FEATURE_SERIALIZATION
+ [Ignore("Mapping Document has Any type")]
+#endif
[TestFixture]
public class Fixture : BugTestCase
{
@@ -98,4 +101,4 @@ public void AnyIs_HqlWorksWithClassNameInTheLeft()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/NHSpecificTest/NH2484/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH2484/Fixture.cs
index b14b6ba04b9..a98dab1da6c 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH2484/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH2484/Fixture.cs
@@ -1,3 +1,5 @@
+#if FEATURE_SERIALIZATION
+
using System;
using System.Drawing;
using System.Reflection;
@@ -18,7 +20,7 @@ protected override bool AppliesTo(NHibernate.Dialect.Dialect dialect)
[Test]
public void TestPersistenceOfClassWithUnknownSerializableType()
{
- Assembly assembly = Assembly.Load(MappingsAssembly);
+ Assembly assembly = Assembly.Load(new AssemblyName(MappingsAssembly));
var stream = assembly.GetManifestResourceStream("NHibernate.Test.NHSpecificTest.NH2484.food-photo.jpg");
var image = Bitmap.FromStream(stream);
@@ -50,7 +52,7 @@ public void TestPersistenceOfClassWithUnknownSerializableType()
[Test]
public void TestPersistenceOfClassWithSerializableType()
{
- Assembly assembly = Assembly.Load(MappingsAssembly);
+ Assembly assembly = Assembly.Load(new AssemblyName(MappingsAssembly));
var stream = assembly.GetManifestResourceStream("NHibernate.Test.NHSpecificTest.NH2484.food-photo.jpg");
var image = Bitmap.FromStream(stream);
@@ -79,4 +81,6 @@ public void TestPersistenceOfClassWithSerializableType()
stream.Dispose();
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/NHSpecificTest/NH2484/Model.cs b/src/NHibernate.Test/NHSpecificTest/NH2484/Model.cs
index 80b7a1caeb5..aacbc1e9b7e 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH2484/Model.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH2484/Model.cs
@@ -1,5 +1,7 @@
using System;
+#if FEATURE_SERIALIZATION
using System.Runtime.Serialization;
+#endif
namespace NHibernate.Test.NHSpecificTest.NH2484
{
@@ -12,6 +14,8 @@ public class ClassWithImage
public class ClassWithSerializableType
{
public virtual int Id { get; set; }
+#if FEATURE_SERIALIZATION
public virtual ISerializable Image { get; set; }
+#endif
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/NHSpecificTest/NH2773/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH2773/Fixture.cs
index ecabe34dde7..1a90d0d14c6 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH2773/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH2773/Fixture.cs
@@ -1,3 +1,5 @@
+#if FEATURE_SERIALIZATION
+
using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
@@ -69,4 +71,6 @@ public void DeserializedSession_ProxyType_ShouldBeEqualToOriginalProxyType() {
Assert.AreEqual(originalProxyType, deserializedProxyType);
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/NHSpecificTest/NH2880/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH2880/Fixture.cs
index e94a53f9bdd..21a0680d75f 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH2880/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH2880/Fixture.cs
@@ -1,3 +1,5 @@
+#if FEATURE_SERIALIZATION
+
using System;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
@@ -97,4 +99,6 @@ protected override void OnTearDown()
}
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/NHSpecificTest/NH2898/BinaryFormatterCache.cs b/src/NHibernate.Test/NHSpecificTest/NH2898/BinaryFormatterCache.cs
index bdb364c5621..c424be9961d 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH2898/BinaryFormatterCache.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH2898/BinaryFormatterCache.cs
@@ -1,3 +1,5 @@
+#if FEATURE_SERIALIZATION
+
using System.Collections;
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
@@ -77,4 +79,6 @@ public string RegionName
get { return _regionName; }
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/NHSpecificTest/NH2898/BinaryFormatterCacheProvider.cs b/src/NHibernate.Test/NHSpecificTest/NH2898/BinaryFormatterCacheProvider.cs
index 6c9f8357124..c446da9209f 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH2898/BinaryFormatterCacheProvider.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH2898/BinaryFormatterCacheProvider.cs
@@ -1,3 +1,5 @@
+#if FEATURE_SERIALIZATION
+
using System.Collections.Generic;
using NHibernate.Cache;
@@ -27,4 +29,6 @@ public void Stop()
#endregion
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/NHSpecificTest/NH2898/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH2898/Fixture.cs
index 8f448b5c75e..9c974afe6f9 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH2898/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH2898/Fixture.cs
@@ -1,3 +1,5 @@
+#if FEATURE_SERIALIZATION
+
using NHibernate.Cfg;
using NHibernate.Criterion;
using NHibernate.Engine;
@@ -117,4 +119,6 @@ public void SecondLevelCacheWithHqlQueries()
}
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/NHSpecificTest/NH3119/FixtureByCode.cs b/src/NHibernate.Test/NHSpecificTest/NH3119/FixtureByCode.cs
index 3c03929806a..0017e6fdb84 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH3119/FixtureByCode.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH3119/FixtureByCode.cs
@@ -1,12 +1,15 @@
using System.IO;
using System.Linq;
-using System.Runtime.Serialization.Formatters.Binary;
using NHibernate.Cfg;
using NHibernate.Cfg.MappingSchema;
using NHibernate.Linq;
using NHibernate.Mapping.ByCode;
using NUnit.Framework;
+#if FEATURE_SERIALIZATION
+using System.Runtime.Serialization.Formatters.Binary;
+#endif
+
namespace NHibernate.Test.NHSpecificTest.NH3119
{
///
@@ -79,6 +82,7 @@ public void PocoComponentTuplizer_Instantiate_UsesReflectonOptimizer()
}
}
+#if FEATURE_SERIALIZATION
[Test]
public void PocoComponentTuplizerOfDeserializedConfiguration_Instantiate_UsesReflectonOptimizer()
{
@@ -101,5 +105,6 @@ public void PocoComponentTuplizerOfDeserializedConfiguration_Instantiate_UsesRef
StringAssert.Contains("NHibernate.Bytecode.Lightweight.ReflectionOptimizer.CreateInstance", stackTrace);
}
}
+#endif
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/NHSpecificTest/NH3121/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH3121/Fixture.cs
index 16bb4da24f3..af778462f00 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH3121/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH3121/Fixture.cs
@@ -8,6 +8,9 @@
namespace NHibernate.Test.NHSpecificTest.NH3121
{
+#if !FEATURE_SERIALIZATION
+ [Ignore("Mapping Document has Serializable type")]
+#endif
[TestFixture]
public class Fixture : BugTestCase
{
@@ -50,7 +53,7 @@ public void ShouldThrowWhenByteArrayTooLong()
[Test]
public void ShouldThrowWhenImageTooLarge()
{
- Assembly assembly = Assembly.Load(MappingsAssembly);
+ Assembly assembly = Assembly.Load(new AssemblyName(MappingsAssembly));
var stream = assembly.GetManifestResourceStream("NHibernate.Test.NHSpecificTest.NH2484.food-photo.jpg");
var image = Bitmap.FromStream(stream);
@@ -65,10 +68,11 @@ public void ShouldThrowWhenImageTooLarge()
}
+#if FEATURE_SERIALIZATION
[Test]
public void ShouldThrowWhenImageAsISerializableTooLarge()
{
- Assembly assembly = Assembly.Load(MappingsAssembly);
+ Assembly assembly = Assembly.Load(new AssemblyName(MappingsAssembly));
var stream = assembly.GetManifestResourceStream("NHibernate.Test.NHSpecificTest.NH2484.food-photo.jpg");
var image = Bitmap.FromStream(stream);
@@ -81,7 +85,7 @@ public void ShouldThrowWhenImageAsISerializableTooLarge()
Assert.That(ex.InnerException.Message,
Is.EqualTo("The length of the byte[] value exceeds the length configured in the mapping/parameter."));
}
-
+#endif
private void PersistReport(Report report)
{
diff --git a/src/NHibernate.Test/NHSpecificTest/NH3121/Report.cs b/src/NHibernate.Test/NHSpecificTest/NH3121/Report.cs
index 821a352e0a1..966a1db2d3e 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH3121/Report.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH3121/Report.cs
@@ -1,9 +1,12 @@
using System;
using System.Collections.Generic;
using System.Linq;
-using System.Runtime.Serialization;
using System.Text;
+#if FEATURE_SERIALIZATION
+using System.Runtime.Serialization;
+#endif
+
namespace NHibernate.Test.NHSpecificTest.NH3121
{
public class Report
@@ -12,6 +15,8 @@ public class Report
public virtual Byte[] UnsizedArray { get; set; }
public virtual System.Drawing.Image Image { get; set; }
+#if FEATURE_SERIALIZATION
public virtual ISerializable SerializableImage { get; set; }
+#endif
}
}
diff --git a/src/NHibernate.Test/NHSpecificTest/NH317/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH317/Fixture.cs
index 2313dec63d0..ad20ade841f 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH317/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH317/Fixture.cs
@@ -1,3 +1,4 @@
+#if FEATURE_SERIALIZATION
using System;
using System.Collections;
using System.IO;
@@ -44,13 +45,15 @@ public void ProxySerialization()
// Serialize
IFormatter formatter = new BinaryFormatter();
- MemoryStream ms = new MemoryStream();
- formatter.Serialize(ms, nodeProxy);
+ Node deserializedNodeProxy;
+ using (MemoryStream ms = new MemoryStream())
+ {
+ formatter.Serialize(ms, nodeProxy);
- // Deserialize
- ms.Seek(0, SeekOrigin.Begin);
- Node deserializedNodeProxy = (Node) formatter.Deserialize(ms);
- ms.Close();
+ // Deserialize
+ ms.Seek(0, SeekOrigin.Begin);
+ deserializedNodeProxy = (Node) formatter.Deserialize(ms);
+ }
// Deserialized proxy should implement the INHibernateProxy interface.
Assert.IsTrue(deserializedNodeProxy is INHibernateProxy);
@@ -61,4 +64,5 @@ public void ProxySerialization()
s.Close();
}
}
-}
\ No newline at end of file
+}
+#endif
diff --git a/src/NHibernate.Test/NHSpecificTest/NH3383/FixtureByCode.cs b/src/NHibernate.Test/NHSpecificTest/NH3383/FixtureByCode.cs
index fe2595816ef..bab85f060a5 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH3383/FixtureByCode.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH3383/FixtureByCode.cs
@@ -1,4 +1,6 @@
-using System;
+#if FEATURE_SERIALIZATION
+
+using System;
using System.IO;
using System.Reflection;
using System.Runtime.Serialization.Formatters.Binary;
@@ -160,4 +162,6 @@ public void DeserializeAndAssert(MemoryStream configMemoryStream)
}
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/NHSpecificTest/NH3487/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH3487/Fixture.cs
index d9ba75df001..041863a3464 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH3487/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH3487/Fixture.cs
@@ -1,4 +1,6 @@
-using System.IO;
+#if FEATURE_SERIALIZATION
+
+using System.IO;
using System.Runtime.Serialization;
using System.Runtime.Serialization.Formatters.Binary;
using NUnit.Framework;
@@ -80,4 +82,6 @@ public void CanDeserializeSessionWithEntityHashCollision()
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/NHSpecificTest/NH3614/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH3614/Fixture.cs
index e93a46c0213..a8046782077 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH3614/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH3614/Fixture.cs
@@ -7,6 +7,9 @@
namespace NHibernate.Test.NHSpecificTest.NH3614
{
+#if !FEATURE_SERIALIZATION
+ [Ignore("Mapping Document has Serializable type")]
+#endif
[TestFixture]
public class Fixture : BugTestCase
{
diff --git a/src/NHibernate.Test/NHSpecificTest/NH3731/FixtureByCode.cs b/src/NHibernate.Test/NHSpecificTest/NH3731/FixtureByCode.cs
index e87deb65286..3ed08c4c3b0 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH3731/FixtureByCode.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH3731/FixtureByCode.cs
@@ -1,4 +1,6 @@
-using System.IO;
+#if FEATURE_SERIALIZATION
+
+using System.IO;
using System.Linq;
using System.Runtime.Serialization.Formatters.Binary;
using NHibernate.Cfg.MappingSchema;
@@ -142,4 +144,6 @@ public void Serializing_Session_After_Changing_Key_ChildrenMap_Should_Work()
}
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/NHSpecificTest/NH3795/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH3795/Fixture.cs
index 17f559d6c13..fe6b4dbfd09 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH3795/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH3795/Fixture.cs
@@ -7,6 +7,9 @@ namespace NHibernate.Test.NHSpecificTest.NH3795
///
/// Tests in this class only failed when the code was build with the Roslyn compiler which is included in Visual Studio 2015
///
+#if !FEATURE_SERIALIZATION
+ [Ignore("Mapping Document has Any type")]
+#endif
[TestFixture]
public class Fixture : TestCase
{
diff --git a/src/NHibernate.Test/NHSpecificTest/NH719/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH719/Fixture.cs
index 430ac9ff691..ca96eaeb554 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH719/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH719/Fixture.cs
@@ -2,6 +2,9 @@
namespace NHibernate.Test.NHSpecificTest.NH719
{
+#if !FEATURE_SERIALIZATION
+ [Ignore("Mapping Document has Any type")]
+#endif
[TestFixture]
public class Fixture : BugTestCase
{
@@ -67,4 +70,4 @@ public void CacheLoadTest()
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/NHSpecificTest/NH732/Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH732/Fixture.cs
index 1c88666e8b3..134739b5595 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH732/Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH732/Fixture.cs
@@ -70,12 +70,12 @@ public System.Type ReturnedType
public new bool Equals(object x, object y)
{
- return StringComparer.InvariantCultureIgnoreCase.Equals((string)x, (string)y);
+ return StringComparer.OrdinalIgnoreCase.Equals((string)x, (string)y);
}
public int GetHashCode(object x)
{
- return StringComparer.InvariantCultureIgnoreCase.GetHashCode((string)x);
+ return StringComparer.OrdinalIgnoreCase.GetHashCode((string)x);
}
public object NullSafeGet(DbDataReader rs, string[] names, object owner)
diff --git a/src/NHibernate.Test/NHSpecificTest/NH958/NH958Fixture.cs b/src/NHibernate.Test/NHSpecificTest/NH958/NH958Fixture.cs
index 095e5957e3a..bd9fc650e19 100644
--- a/src/NHibernate.Test/NHSpecificTest/NH958/NH958Fixture.cs
+++ b/src/NHibernate.Test/NHSpecificTest/NH958/NH958Fixture.cs
@@ -5,6 +5,9 @@
namespace NHibernate.Test.NHSpecificTest.NH958
{
+#if !FEATURE_SERIALIZATION
+ [Ignore("Mapping Document has Any type")]
+#endif
[TestFixture]
public class NH958Fixture : BugTestCase
{
diff --git a/src/NHibernate.Test/NHibernate.Test.csproj b/src/NHibernate.Test/NHibernate.Test.csproj
index 8fae8736b23..13e8f307ea5 100644
--- a/src/NHibernate.Test/NHibernate.Test.csproj
+++ b/src/NHibernate.Test/NHibernate.Test.csproj
@@ -1,109 +1,64 @@

-
+
+
Debug
AnyCPU
- 9.0.30729
- 2.0
- {7AEE5B37-C552-4E59-9B6F-88755BCB5070}
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}
Library
Properties
- NHibernate.Test
- NHibernate.Test
-
-
- 3.5
-
-
+ NHibernate.Test2
+ NHibernate.Test2
v4.6.1
- publish\
- true
- Disk
- false
- Foreground
- 7
- Days
- false
- false
- true
- 0
- 1.0.0.%2a
- false
- false
- true
- Program
- $(MSBuildProjectDirectory)\..\..\Tools\nunit\nunit-x86.exe
- NHibernate.Test.dll
-
+ 512
true
full
false
- bin\Debug-2.0\
- obj\
- obj\Debug-2.0\
- NET,NET_2_0
+ bin\Debug\
+ DEBUG;TRACE
prompt
4
- false
- 3001%3b3002%3b3003%3b3004%3b3005
- AllRules.ruleset
- AnyCPU
- false
pdbonly
true
- bin\Release-2.0\
- obj\
- obj\Release-2.0\
- TRACE;NET,NET_2_0
+ bin\Release\
+ TRACE
prompt
4
- false
- 3001%3b3002%3b3003%3b3004%3b3005
- AllRules.ruleset
- false
-
+
..\packages\Antlr3.Runtime.3.5.1\lib\net40-client\Antlr3.Runtime.dll
- True
..\packages\Iesi.Collections.4.0.1.4000\lib\net40\Iesi.Collections.dll
- True
-
- ..\packages\log4net.2.0.7\lib\net45-full\log4net.dll
- True
+
+ ..\packages\log4net.2.0.8\lib\net45-full\log4net.dll
-
- ..\packages\NUnit.3.6.0\lib\net45\nunit.framework.dll
- True
+
+ ..\packages\NUnit.3.6.1\lib\net45\nunit.framework.dll
-
- ..\packages\Remotion.Linq.1.13.183.0\lib\net35\Remotion.Linq.dll
- True
+
+ ..\packages\Remotion.Linq.1.15.15.0\lib\portable-net45+wp80+wpa81+win\Remotion.Linq.dll
-
-
- 3.5
-
-
+
+
..\packages\System.Linq.Dynamic.1.0.7\lib\net40\System.Linq.Dynamic.dll
- True
-
+
+
+
-
- 3.5
-
+
+
@@ -1365,6 +1320,7 @@
+
@@ -3798,14 +3754,5 @@
-
-
-
-
+
\ No newline at end of file
diff --git a/src/NHibernate.Test/QueryTest/DetachedQueryFixture.cs b/src/NHibernate.Test/QueryTest/DetachedQueryFixture.cs
index f156778901d..add486fd1b4 100644
--- a/src/NHibernate.Test/QueryTest/DetachedQueryFixture.cs
+++ b/src/NHibernate.Test/QueryTest/DetachedQueryFixture.cs
@@ -425,6 +425,7 @@ public void ResultTransformer()
}
}
+#if FEATURE_SERIALIZATION
[Test]
public void Serializable()
{
@@ -439,6 +440,7 @@ public void Serializable()
dqs.GetExecutableQuery(s).List();
}
}
+#endif
[Test, Explicit]
public void PerformanceDiffSimplyQuery()
diff --git a/src/NHibernate.Test/ReadOnly/ReadOnlyCriteriaQueryTest.cs b/src/NHibernate.Test/ReadOnly/ReadOnlyCriteriaQueryTest.cs
index 04a9b314a7b..38eb02c857e 100644
--- a/src/NHibernate.Test/ReadOnly/ReadOnlyCriteriaQueryTest.cs
+++ b/src/NHibernate.Test/ReadOnly/ReadOnlyCriteriaQueryTest.cs
@@ -1049,7 +1049,8 @@ public void Subselect()
t.Commit();
}
}
-
+
+#if FEATURE_SERIALIZATION
[Test]
public void DetachedCriteria()
{
@@ -1103,6 +1104,7 @@ public void DetachedCriteria()
t.Commit();
}
}
+#endif
[Test]
public void TwoAliasesCache()
diff --git a/src/NHibernate/Util/SerializationHelper.cs b/src/NHibernate.Test/SerializationHelper.cs
similarity index 90%
rename from src/NHibernate/Util/SerializationHelper.cs
rename to src/NHibernate.Test/SerializationHelper.cs
index 5051d0693c9..e4e956e12bf 100644
--- a/src/NHibernate/Util/SerializationHelper.cs
+++ b/src/NHibernate.Test/SerializationHelper.cs
@@ -1,8 +1,9 @@
-using System;
+#if FEATURE_SERIALIZATION
+
using System.IO;
using System.Runtime.Serialization.Formatters.Binary;
-namespace NHibernate.Util
+namespace NHibernate.Test
{
public class SerializationHelper
{
@@ -29,4 +30,6 @@ public static object Deserialize(byte[] data)
}
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate.Test/TestCase.cs b/src/NHibernate.Test/TestCase.cs
index 0d7c4742556..8920abab3de 100644
--- a/src/NHibernate.Test/TestCase.cs
+++ b/src/NHibernate.Test/TestCase.cs
@@ -231,7 +231,7 @@ private void Configure()
protected virtual void AddMappings(Configuration configuration)
{
- Assembly assembly = Assembly.Load(MappingsAssembly);
+ Assembly assembly = Assembly.Load(new AssemblyName(MappingsAssembly));
foreach (string file in Mappings)
{
diff --git a/src/NHibernate.Test/TypeParameters/TypeParameterTest.cs b/src/NHibernate.Test/TypeParameters/TypeParameterTest.cs
index a64abc914e1..63fd54aa4f0 100644
--- a/src/NHibernate.Test/TypeParameters/TypeParameterTest.cs
+++ b/src/NHibernate.Test/TypeParameters/TypeParameterTest.cs
@@ -64,18 +64,18 @@ public void Save()
statement.Connection = connection;
t.Enlist(statement);
statement.Parameters[0].Value = id;
- var reader = statement.ExecuteReader();
-
- Assert.IsTrue(reader.Read(), "A row should have been returned");
- Assert.IsTrue(reader.GetValue(reader.GetOrdinal("VALUE_ONE")) == DBNull.Value,
- "Default value should have been mapped to null");
- Assert.IsTrue(reader.GetValue(reader.GetOrdinal("VALUE_TWO")) == DBNull.Value,
- "Default value should have been mapped to null");
- Assert.AreEqual(Convert.ToInt32(reader.GetValue(reader.GetOrdinal("VALUE_THREE"))), 5,
- "Non-Default value should not be changed");
- Assert.IsTrue(reader.GetValue(reader.GetOrdinal("VALUE_FOUR")) == DBNull.Value,
- "Default value should have been mapped to null");
- reader.Close();
+ using (DbDataReader reader = statement.ExecuteReader())
+ {
+ Assert.IsTrue(reader.Read(), "A row should have been returned");
+ Assert.IsTrue(reader.GetValue(reader.GetOrdinal("VALUE_ONE")) == DBNull.Value,
+ "Default value should have been mapped to null");
+ Assert.IsTrue(reader.GetValue(reader.GetOrdinal("VALUE_TWO")) == DBNull.Value,
+ "Default value should have been mapped to null");
+ Assert.AreEqual(Convert.ToInt32(reader.GetValue(reader.GetOrdinal("VALUE_THREE"))), 5,
+ "Non-Default value should not be changed");
+ Assert.IsTrue(reader.GetValue(reader.GetOrdinal("VALUE_FOUR")) == DBNull.Value,
+ "Default value should have been mapped to null");
+ }
t.Commit();
s.Close();
@@ -145,4 +145,4 @@ private void DeleteData()
s.Close();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/TypesTest/BinaryTypeFixture.cs b/src/NHibernate.Test/TypesTest/BinaryTypeFixture.cs
index e0ec802bee1..b31c413d99f 100644
--- a/src/NHibernate.Test/TypesTest/BinaryTypeFixture.cs
+++ b/src/NHibernate.Test/TypesTest/BinaryTypeFixture.cs
@@ -1,11 +1,14 @@
using System;
using System.IO;
-using System.Runtime.Serialization.Formatters.Binary;
using System.Text;
using NHibernate.Dialect;
using NHibernate.Type;
using NUnit.Framework;
+#if FEATURE_SERIALIZATION
+using System.Runtime.Serialization.Formatters.Binary;
+#endif
+
namespace NHibernate.Test.TypesTest
{
///
@@ -152,10 +155,14 @@ private BinaryClass Create(int id)
private byte[] GetByteArray(int value)
{
+#if FEATURE_SERIALIZATION
BinaryFormatter bf = new BinaryFormatter();
MemoryStream stream = new MemoryStream();
bf.Serialize(stream, value);
return stream.ToArray();
+#else
+ return BitConverter.GetBytes(value);
+#endif
}
}
}
diff --git a/src/NHibernate.Test/TypesTest/TypeFactoryFixture.cs b/src/NHibernate.Test/TypesTest/TypeFactoryFixture.cs
index f4dcaffa09e..93e0ac958d5 100644
--- a/src/NHibernate.Test/TypesTest/TypeFactoryFixture.cs
+++ b/src/NHibernate.Test/TypesTest/TypeFactoryFixture.cs
@@ -93,11 +93,13 @@ public void MultiThreadAccess()
TypeFactory.GetBinaryType(rnd.Next(1, 50));
totalCall++;
},
+#if FEATURE_SERIALIZATION
delegate(object o)
{
TypeFactory.GetSerializableType(rnd.Next(1, 50));
totalCall++;
},
+#endif
delegate(object o)
{
TypeFactory.GetTypeType(rnd.Next(1, 20));
diff --git a/src/NHibernate.Test/UtilityTest/LinkedHashMapFixture.cs b/src/NHibernate.Test/UtilityTest/LinkedHashMapFixture.cs
index 875b5fa6ab3..2bf8d74b3cd 100644
--- a/src/NHibernate.Test/UtilityTest/LinkedHashMapFixture.cs
+++ b/src/NHibernate.Test/UtilityTest/LinkedHashMapFixture.cs
@@ -1,10 +1,13 @@
using System;
using System.Collections.Generic;
using System.IO;
-using System.Runtime.Serialization.Formatters.Binary;
using NHibernate.Util;
using NUnit.Framework;
+#if FEATURE_SERIALIZATION
+using System.Runtime.Serialization.Formatters.Binary;
+#endif
+
namespace NHibernate.Test.UtilityTest
{
[TestFixture]
@@ -230,19 +233,22 @@ public void Values()
}
}
+#if FEATURE_SERIALIZATION
[Test]
public void Serialization()
{
IDictionary lhm = new LinkedHashMap();
Fill(lhm);
- MemoryStream stream = new MemoryStream();
- BinaryFormatter f = new BinaryFormatter();
- f.Serialize(stream, lhm);
- stream.Position = 0;
+ LinkedHashMap dlhm;
+ using (MemoryStream stream = new MemoryStream())
+ {
+ BinaryFormatter f = new BinaryFormatter();
+ f.Serialize(stream, lhm);
+ stream.Position = 0;
- LinkedHashMap dlhm = (LinkedHashMap)f.Deserialize(stream);
- stream.Close();
+ dlhm = (LinkedHashMap) f.Deserialize(stream);
+ }
Assert.AreEqual(6, dlhm.Count);
int index = 0;
@@ -255,7 +261,7 @@ public void Serialization()
Assert.AreEqual(6, index);
}
-
+#endif
[Test, Explicit]
public void ShowDiff()
diff --git a/src/NHibernate.Test/UtilityTest/SequencedHashMapFixture.cs b/src/NHibernate.Test/UtilityTest/SequencedHashMapFixture.cs
index 7519f403ffd..96c426f9836 100644
--- a/src/NHibernate.Test/UtilityTest/SequencedHashMapFixture.cs
+++ b/src/NHibernate.Test/UtilityTest/SequencedHashMapFixture.cs
@@ -2,10 +2,13 @@
using System.Collections;
using System.Collections.Specialized;
using System.IO;
-using System.Runtime.Serialization.Formatters.Binary;
using NHibernate.Util;
using NUnit.Framework;
+#if FEATURE_SERIALIZATION
+using System.Runtime.Serialization.Formatters.Binary;
+#endif
+
namespace NHibernate.Test.UtilityTest
{
///
@@ -419,16 +422,19 @@ public void Performance()
}
}
+#if FEATURE_SERIALIZATION
[Test]
public void Serialize()
{
- MemoryStream stream = new MemoryStream();
- BinaryFormatter f = new BinaryFormatter();
- f.Serialize(stream, _shm);
- stream.Position = 0;
+ SequencedHashMap shm;
+ using (MemoryStream stream = new MemoryStream())
+ {
+ BinaryFormatter f = new BinaryFormatter();
+ f.Serialize(stream, _shm);
+ stream.Position = 0;
- SequencedHashMap shm = (SequencedHashMap) f.Deserialize(stream);
- stream.Close();
+ shm = (SequencedHashMap) f.Deserialize(stream);
+ }
Assert.AreEqual(3, shm.Count);
int index = 0;
@@ -441,5 +447,6 @@ public void Serialize()
Assert.AreEqual(3, index);
}
+#endif
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/UtilityTest/WeakHashtableFixture.cs b/src/NHibernate.Test/UtilityTest/WeakHashtableFixture.cs
index ba8bbc42c41..c3ea753728b 100644
--- a/src/NHibernate.Test/UtilityTest/WeakHashtableFixture.cs
+++ b/src/NHibernate.Test/UtilityTest/WeakHashtableFixture.cs
@@ -1,7 +1,5 @@
using System;
using System.Collections;
-using System.IO;
-using System.Runtime.Serialization.Formatters.Binary;
using NHibernate.Util;
using NUnit.Framework;
@@ -114,4 +112,4 @@ public void IsSerializable()
NHAssert.IsSerializable(weakHashtable);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate.Test/packages.config b/src/NHibernate.Test/packages.config
index 4c41501a08e..2dcd37c290f 100644
--- a/src/NHibernate.Test/packages.config
+++ b/src/NHibernate.Test/packages.config
@@ -2,8 +2,8 @@
-
-
-
+
+
+
\ No newline at end of file
diff --git a/src/NHibernate.TestDatabaseSetup/NHibernate.TestDatabaseSetup.csproj b/src/NHibernate.TestDatabaseSetup/NHibernate.TestDatabaseSetup.csproj
index 118e1b4ac07..aec4512f38f 100644
--- a/src/NHibernate.TestDatabaseSetup/NHibernate.TestDatabaseSetup.csproj
+++ b/src/NHibernate.TestDatabaseSetup/NHibernate.TestDatabaseSetup.csproj
@@ -1,5 +1,6 @@

-
+
+
Debug
AnyCPU
@@ -103,11 +104,4 @@
-
\ No newline at end of file
diff --git a/src/NHibernate.sln b/src/NHibernate.sln
index 626bc6a7489..ca58958c7e3 100644
--- a/src/NHibernate.sln
+++ b/src/NHibernate.sln
@@ -1,7 +1,6 @@
Microsoft Visual Studio Solution File, Format Version 12.00
-# Visual Studio 14
-VisualStudioVersion = 14.0.25123.0
-VisualStudioVersion = 14.0.25420.1
+# Visual Studio 15
+VisualStudioVersion = 15.0.26228.9
MinimumVisualStudioVersion = 10.0.40219.1
Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution Items", "{593DCEA7-C933-46F3-939F-D8172399AB05}"
ProjectSection(SolutionItems) = preProject
@@ -10,42 +9,112 @@ Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Solution Items", "Solution
..\teamcity.build = ..\teamcity.build
EndProjectSection
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate", "NHibernate\NHibernate.csproj", "{5909BFE7-93CF-4E5F-BE22-6293368AF01D}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHibernate.TestDatabaseSetup", "NHibernate.TestDatabaseSetup\NHibernate.TestDatabaseSetup.csproj", "{BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.DomainModel", "NHibernate.DomainModel\NHibernate.DomainModel.csproj", "{5C649B55-1B3F-4C38-9998-1B043E94A244}"
+Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "NHibernate", "NHibernate\NHibernate.csproj", "{D39E4139-6011-4DB2-837E-20C9BE221B9C}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.Test", "NHibernate.Test\NHibernate.Test.csproj", "{7AEE5B37-C552-4E59-9B6F-88755BCB5070}"
+Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "NHibernate.Test.VisualBasic", "NHibernate.Test.VisualBasic\NHibernate.Test.VisualBasic.vbproj", "{F43B3253-9011-4DAE-8777-BA0D8DA850A6}"
EndProject
-Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.TestDatabaseSetup", "NHibernate.TestDatabaseSetup\NHibernate.TestDatabaseSetup.csproj", "{BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.DomainModel", "NHibernate.DomainModel\NHibernate.DomainModel.csproj", "{7ABB1237-3251-41E3-92D0-9937D3734E40}"
EndProject
-Project("{F184B08F-C81C-45F6-A57F-5ABD9991F28F}") = "NHibernate.Test.VisualBasic", "NHibernate.Test.VisualBasic\NHibernate.Test.VisualBasic.vbproj", "{7C2EF610-BCA0-4D1F-898A-DE9908E4970C}"
+Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "NHibernate.Test", "NHibernate.Test\NHibernate.Test.csproj", "{1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}"
EndProject
Global
GlobalSection(SolutionConfigurationPlatforms) = preSolution
Debug|Any CPU = Debug|Any CPU
+ Debug|x64 = Debug|x64
+ Debug|x86 = Debug|x86
+ Debug-nofeatures|Any CPU = Debug-nofeatures|Any CPU
+ Debug-nofeatures|x64 = Debug-nofeatures|x64
+ Debug-nofeatures|x86 = Debug-nofeatures|x86
Release|Any CPU = Release|Any CPU
+ Release|x64 = Release|x64
+ Release|x86 = Release|x86
EndGlobalSection
GlobalSection(ProjectConfigurationPlatforms) = postSolution
- {5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5909BFE7-93CF-4E5F-BE22-6293368AF01D}.Release|Any CPU.Build.0 = Release|Any CPU
- {5C649B55-1B3F-4C38-9998-1B043E94A244}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {5C649B55-1B3F-4C38-9998-1B043E94A244}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {5C649B55-1B3F-4C38-9998-1B043E94A244}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {5C649B55-1B3F-4C38-9998-1B043E94A244}.Release|Any CPU.Build.0 = Release|Any CPU
- {7AEE5B37-C552-4E59-9B6F-88755BCB5070}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7AEE5B37-C552-4E59-9B6F-88755BCB5070}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7AEE5B37-C552-4E59-9B6F-88755BCB5070}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7AEE5B37-C552-4E59-9B6F-88755BCB5070}.Release|Any CPU.Build.0 = Release|Any CPU
{BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
{BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}.Debug-nofeatures|Any CPU.ActiveCfg = Debug|Any CPU
+ {BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}.Debug-nofeatures|Any CPU.Build.0 = Debug|Any CPU
+ {BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}.Debug-nofeatures|x64.ActiveCfg = Debug|Any CPU
+ {BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}.Debug-nofeatures|x86.ActiveCfg = Debug|Any CPU
{BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}.Release|Any CPU.ActiveCfg = Release|Any CPU
{BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}.Release|Any CPU.Build.0 = Release|Any CPU
- {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
- {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Debug|Any CPU.Build.0 = Debug|Any CPU
- {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Release|Any CPU.ActiveCfg = Release|Any CPU
- {7C2EF610-BCA0-4D1F-898A-DE9908E4970C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}.Release|x64.ActiveCfg = Release|Any CPU
+ {BEEC1564-6FB6-49F7-BBE5-8EBD2F0F6E8A}.Release|x86.ActiveCfg = Release|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Debug|x64.Build.0 = Debug|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Debug|x86.Build.0 = Debug|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Debug-nofeatures|Any CPU.ActiveCfg = Debug|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Debug-nofeatures|x64.ActiveCfg = Debug|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Debug-nofeatures|x64.Build.0 = Debug|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Debug-nofeatures|x86.ActiveCfg = Debug|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Debug-nofeatures|x86.Build.0 = Debug|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Release|Any CPU.Build.0 = Release|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Release|x64.ActiveCfg = Release|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Release|x64.Build.0 = Release|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Release|x86.ActiveCfg = Release|Any CPU
+ {D39E4139-6011-4DB2-837E-20C9BE221B9C}.Release|x86.Build.0 = Release|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Debug|x64.Build.0 = Debug|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Debug|x86.Build.0 = Debug|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Debug-nofeatures|Any CPU.ActiveCfg = Debug|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Debug-nofeatures|Any CPU.Build.0 = Debug|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Debug-nofeatures|x64.ActiveCfg = Debug|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Debug-nofeatures|x64.Build.0 = Debug|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Debug-nofeatures|x86.ActiveCfg = Debug|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Debug-nofeatures|x86.Build.0 = Debug|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Release|Any CPU.Build.0 = Release|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Release|x64.ActiveCfg = Release|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Release|x64.Build.0 = Release|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Release|x86.ActiveCfg = Release|Any CPU
+ {F43B3253-9011-4DAE-8777-BA0D8DA850A6}.Release|x86.Build.0 = Release|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Debug|x64.Build.0 = Debug|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Debug|x86.Build.0 = Debug|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Debug-nofeatures|Any CPU.ActiveCfg = Debug|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Debug-nofeatures|Any CPU.Build.0 = Debug|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Debug-nofeatures|x64.ActiveCfg = Debug|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Debug-nofeatures|x64.Build.0 = Debug|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Debug-nofeatures|x86.ActiveCfg = Debug|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Debug-nofeatures|x86.Build.0 = Debug|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Release|Any CPU.Build.0 = Release|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Release|x64.ActiveCfg = Release|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Release|x64.Build.0 = Release|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Release|x86.ActiveCfg = Release|Any CPU
+ {7ABB1237-3251-41E3-92D0-9937D3734E40}.Release|x86.Build.0 = Release|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Debug|Any CPU.Build.0 = Debug|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Debug|x64.ActiveCfg = Debug|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Debug|x64.Build.0 = Debug|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Debug|x86.ActiveCfg = Debug|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Debug|x86.Build.0 = Debug|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Debug-nofeatures|Any CPU.ActiveCfg = Debug|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Debug-nofeatures|Any CPU.Build.0 = Debug|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Debug-nofeatures|x64.ActiveCfg = Debug|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Debug-nofeatures|x64.Build.0 = Debug|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Debug-nofeatures|x86.ActiveCfg = Debug|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Debug-nofeatures|x86.Build.0 = Debug|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Release|Any CPU.ActiveCfg = Release|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Release|Any CPU.Build.0 = Release|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Release|x64.ActiveCfg = Release|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Release|x64.Build.0 = Release|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Release|x86.ActiveCfg = Release|Any CPU
+ {1B7E9512-5B0F-45BE-82AD-5EBDA404BDE3}.Release|x86.Build.0 = Release|Any CPU
EndGlobalSection
GlobalSection(SolutionProperties) = preSolution
HideSolutionNode = FALSE
diff --git a/src/NHibernate/ADOException.cs b/src/NHibernate/ADOException.cs
index f8cfe3b7331..c5cde1f9337 100644
--- a/src/NHibernate/ADOException.cs
+++ b/src/NHibernate/ADOException.cs
@@ -1,7 +1,9 @@
using System;
+
+#if FEATURE_SERIALIZATION
using System.Runtime.Serialization;
using System.Security;
-using System.Security.Permissions;
+#endif
namespace NHibernate
{
@@ -41,6 +43,7 @@ public ADOException(string message, Exception innerException, string sql)
this.sql = sql;
}
+#if FEATURE_SERIALIZATION
///
/// Initializes a new instance of the class.
///
@@ -62,6 +65,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont
base.GetObjectData(info, context);
info.AddValue("sql", sql);
}
+#endif
public string SqlString
{
diff --git a/src/NHibernate/Action/CollectionAction.cs b/src/NHibernate/Action/CollectionAction.cs
index cfdedcb23e0..9c0c2b00efa 100644
--- a/src/NHibernate/Action/CollectionAction.cs
+++ b/src/NHibernate/Action/CollectionAction.cs
@@ -1,5 +1,4 @@
using System;
-using System.Runtime.Serialization;
using NHibernate.Cache;
using NHibernate.Cache.Access;
using NHibernate.Collection;
@@ -8,13 +7,21 @@
using NHibernate.Persister.Collection;
using NHibernate.Util;
+#if FEATURE_SERIALIZATION
+using System.Runtime.Serialization;
+#endif
+
namespace NHibernate.Action
{
///
/// Any action relating to insert/update/delete of a collection
///
[Serializable]
- public abstract class CollectionAction : IExecutable, IComparable, IDeserializationCallback
+ public abstract class CollectionAction
+ : IExecutable, IComparable
+#if FEATURE_SERIALIZATION
+ , IDeserializationCallback
+#endif
{
private readonly object key;
private object finalKey;
@@ -174,6 +181,7 @@ public override string ToString()
return StringHelper.Unqualify(GetType().FullName) + MessageHelper.InfoString(collectionRole, key);
}
+#if FEATURE_SERIALIZATION
#region IDeserializationCallback Members
void IDeserializationCallback.OnDeserialization(object sender)
@@ -182,5 +190,6 @@ void IDeserializationCallback.OnDeserialization(object sender)
}
#endregion
+#endif
}
}
diff --git a/src/NHibernate/Action/EntityAction.cs b/src/NHibernate/Action/EntityAction.cs
index 7ec15006c81..de433c6c3c9 100644
--- a/src/NHibernate/Action/EntityAction.cs
+++ b/src/NHibernate/Action/EntityAction.cs
@@ -1,11 +1,14 @@
using System;
using System.IO;
-using System.Runtime.Serialization;
using NHibernate.Engine;
using NHibernate.Persister.Entity;
using NHibernate.Util;
using NHibernate.Impl;
+#if FEATURE_SERIALIZATION
+using System.Runtime.Serialization;
+#endif
+
namespace NHibernate.Action
{
///
@@ -13,7 +16,11 @@ namespace NHibernate.Action
/// instance.
///
[Serializable]
- public abstract class EntityAction : IExecutable, IComparable, IDeserializationCallback
+ public abstract class EntityAction
+ : IExecutable, IComparable
+#if FEATURE_SERIALIZATION
+ , IDeserializationCallback
+#endif
{
private readonly string entityName;
private readonly object id;
@@ -160,6 +167,7 @@ public virtual int CompareTo(EntityAction other)
#endregion
+#if FEATURE_SERIALIZATION
#region IDeserializationCallback Members
void IDeserializationCallback.OnDeserialization(object sender)
@@ -175,6 +183,7 @@ void IDeserializationCallback.OnDeserialization(object sender)
}
#endregion
+#endif
public override string ToString()
{
diff --git a/src/NHibernate/AdoNet/ConnectionManager.cs b/src/NHibernate/AdoNet/ConnectionManager.cs
index 5ace6b15a2f..673605e5887 100644
--- a/src/NHibernate/AdoNet/ConnectionManager.cs
+++ b/src/NHibernate/AdoNet/ConnectionManager.cs
@@ -1,12 +1,14 @@
using System;
using System.Data;
using System.Data.Common;
-using System.Runtime.Serialization;
-using System.Security;
-using System.Security.Permissions;
using NHibernate.Engine;
+#if FEATURE_SERIALIZATION
+using System.Runtime.Serialization;
+using System.Security;
+#endif
+
namespace NHibernate.AdoNet
{
///
@@ -17,7 +19,10 @@ namespace NHibernate.AdoNet
/// combined.
///
[Serializable]
- public class ConnectionManager : ISerializable, IDeserializationCallback
+ public class ConnectionManager
+#if FEATURE_SERIALIZATION
+ : ISerializable, IDeserializationCallback
+#endif
{
private static readonly IInternalLogger log = LoggerProvider.LoggerFor(typeof(ConnectionManager));
@@ -70,7 +75,11 @@ public bool IsInActiveTransaction
{
if (transaction != null && transaction.IsActive)
return true;
+#if FEATURE_SYSTEM_TRANSACTIONS
return Factory.TransactionFactory.IsInDistributedActiveTransaction(session);
+#else
+ return false;
+#endif
}
}
@@ -272,6 +281,7 @@ public void FlushEnding()
AfterStatement();
}
+#if FEATURE_SERIALIZATION
#region Serialization
private ConnectionManager(SerializationInfo info, StreamingContext context)
@@ -302,6 +312,7 @@ void IDeserializationCallback.OnDeserialization(object sender)
}
#endregion
+#endif
public ITransaction BeginTransaction(IsolationLevel isolationLevel)
{
diff --git a/src/NHibernate/AdoNet/MySqlClientSqlCommandSet.cs b/src/NHibernate/AdoNet/MySqlClientSqlCommandSet.cs
index af87b6aae5c..d2c539e97a3 100644
--- a/src/NHibernate/AdoNet/MySqlClientSqlCommandSet.cs
+++ b/src/NHibernate/AdoNet/MySqlClientSqlCommandSet.cs
@@ -20,7 +20,7 @@ public class MySqlClientSqlCommandSet : IDisposable
static MySqlClientSqlCommandSet()
{
- var sysData = Assembly.Load("MySql.Data");
+ var sysData = Assembly.Load(new AssemblyName("MySql.Data"));
adapterType = sysData.GetType("MySql.Data.MySqlClient.MySqlDataAdapter");
Debug.Assert(adapterType != null, "Could not find MySqlDataAdapter!");
@@ -71,4 +71,4 @@ public int CountOfCommands
get { return countOfCommands; }
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate/AdoNet/OracleDataClientBatchingBatcher.cs b/src/NHibernate/AdoNet/OracleDataClientBatchingBatcher.cs
index 0398dcb08cd..6f89533dc6f 100644
--- a/src/NHibernate/AdoNet/OracleDataClientBatchingBatcher.cs
+++ b/src/NHibernate/AdoNet/OracleDataClientBatchingBatcher.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Data.Common;
+using System.Reflection;
using System.Text;
using NHibernate.AdoNet.Util;
using NHibernate.Exceptions;
@@ -167,4 +168,4 @@ public override int BatchSize
set { _batchSize = value; }
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate/AdoNet/ResultSetWrapper.cs b/src/NHibernate/AdoNet/ResultSetWrapper.cs
index 75e03a3ef5e..a890f497124 100644
--- a/src/NHibernate/AdoNet/ResultSetWrapper.cs
+++ b/src/NHibernate/AdoNet/ResultSetWrapper.cs
@@ -27,15 +27,19 @@ internal DbDataReader Target
get { return rs; }
}
+#if FEATURE_DATA_CLOSE || NET_4_0
public override void Close()
{
rs.Close();
}
+#endif
+#if FEATURE_DATA_GETSCHEMATABLE || NET_4_0
public override DataTable GetSchemaTable()
{
return rs.GetSchemaTable();
}
+#endif
public override bool NextResult()
{
@@ -76,9 +80,9 @@ protected override void Dispose(bool disposing)
if (disposing && rs != null)
{
- rs.Dispose();
+ rs.Dispose();
rs = null;
- }
+ }
disposed = true;
}
diff --git a/src/NHibernate/AdoNet/SqlClientBatchingBatcher.cs b/src/NHibernate/AdoNet/SqlClientBatchingBatcher.cs
index 2fbff365c61..b492eee824d 100644
--- a/src/NHibernate/AdoNet/SqlClientBatchingBatcher.cs
+++ b/src/NHibernate/AdoNet/SqlClientBatchingBatcher.cs
@@ -1,3 +1,5 @@
+#if FEATURE_ADONET_SQLCOMMANDSET
+
using System;
using System.Data.Common;
using System.Text;
@@ -118,4 +120,6 @@ private SqlClientSqlCommandSet CreateConfiguredBatch()
return result;
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate/AdoNet/SqlClientBatchingBatcherFactory.cs b/src/NHibernate/AdoNet/SqlClientBatchingBatcherFactory.cs
index 61304f1241e..8cd8e8f0d89 100644
--- a/src/NHibernate/AdoNet/SqlClientBatchingBatcherFactory.cs
+++ b/src/NHibernate/AdoNet/SqlClientBatchingBatcherFactory.cs
@@ -1,3 +1,5 @@
+#if FEATURE_ADONET_SQLCOMMANDSET
+
using NHibernate.Engine;
namespace NHibernate.AdoNet
@@ -9,4 +11,6 @@ public virtual IBatcher CreateBatcher(ConnectionManager connectionManager, IInte
return new SqlClientBatchingBatcher(connectionManager, interceptor);
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate/AdoNet/SqlClientSqlCommandSet.cs b/src/NHibernate/AdoNet/SqlClientSqlCommandSet.cs
index 9a36255c77c..da1a18d3f23 100644
--- a/src/NHibernate/AdoNet/SqlClientSqlCommandSet.cs
+++ b/src/NHibernate/AdoNet/SqlClientSqlCommandSet.cs
@@ -1,3 +1,5 @@
+#if FEATURE_ADONET_SQLCOMMANDSET
+
using System;
using System.Data.SqlClient;
using System.Diagnostics;
@@ -32,7 +34,7 @@ public class SqlClientSqlCommandSet : IDisposable
static SqlClientSqlCommandSet()
{
- var sysData = Assembly.Load("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089");
+ var sysData = Assembly.Load(new AssemblyName("System.Data, Version=4.0.0.0, Culture=neutral, PublicKeyToken=b77a5c561934e089"));
sqlCmdSetType = sysData.GetType("System.Data.SqlClient.SqlCommandSet");
Debug.Assert(sqlCmdSetType != null, "Could not find SqlCommandSet!");
@@ -135,3 +137,5 @@ public void Dispose()
}
}
}
+
+#endif
diff --git a/src/NHibernate/AdoNet/TooManyRowsAffectedException.cs b/src/NHibernate/AdoNet/TooManyRowsAffectedException.cs
index bcf54ff1e63..c3e9ddae8df 100644
--- a/src/NHibernate/AdoNet/TooManyRowsAffectedException.cs
+++ b/src/NHibernate/AdoNet/TooManyRowsAffectedException.cs
@@ -1,7 +1,9 @@
using System;
+
+#if FEATURE_SERIALIZATION
using System.Runtime.Serialization;
using System.Security;
-using System.Security.Permissions;
+#endif
namespace NHibernate.AdoNet
{
@@ -18,6 +20,7 @@ public TooManyRowsAffectedException(String message, int expectedRowCount, int ac
this.actualRowCount = actualRowCount;
}
+#if FEATURE_SERIALIZATION
protected TooManyRowsAffectedException(SerializationInfo info, StreamingContext context)
: base(info, context)
{
@@ -32,6 +35,7 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont
info.AddValue("expectedRowCount", expectedRowCount);
info.AddValue("actualRowCount", actualRowCount);
}
+#endif
public int ExpectedRowCount
{
diff --git a/src/NHibernate/AssemblyInfo.cs b/src/NHibernate/AssemblyInfo.cs
index 4fd3d6bd0e6..de5db6cca54 100644
--- a/src/NHibernate/AssemblyInfo.cs
+++ b/src/NHibernate/AssemblyInfo.cs
@@ -9,6 +9,8 @@
[assembly: AssemblyProductAttribute("NHibernate")]
[assembly: AssemblyCopyrightAttribute("Licensed under LGPL.")]
[assembly: AssemblyDelaySignAttribute(false)]
+#if FEATURE_SECURITY_PERMISSIONS
[assembly: AllowPartiallyTrustedCallersAttribute()]
[assembly: SecurityRulesAttribute(SecurityRuleSet.Level1)]
+#endif
diff --git a/src/NHibernate/AssertionFailure.cs b/src/NHibernate/AssertionFailure.cs
index b2436bce519..1917af70ff4 100644
--- a/src/NHibernate/AssertionFailure.cs
+++ b/src/NHibernate/AssertionFailure.cs
@@ -1,5 +1,8 @@
using System;
+
+#if FEATURE_SERIALIZATION
using System.Runtime.Serialization;
+#endif
namespace NHibernate
@@ -8,7 +11,7 @@ namespace NHibernate
/// Indicates failure of an assertion: a possible bug in NHibernate
///
[Serializable]
- public class AssertionFailure : ApplicationException
+ public class AssertionFailure : Exception
{
private const string DefaultMessage = "An AssertionFailure occurred - this may indicate a bug in NHibernate or in your custom types.";
@@ -43,6 +46,7 @@ public AssertionFailure(string message, Exception innerException) : base(message
LoggerProvider.LoggerFor(typeof(AssertionFailure)).Error(DefaultMessage, innerException);
}
+#if FEATURE_SERIALIZATION
///
/// Initializes a new instance of the class.
///
@@ -56,5 +60,6 @@ public AssertionFailure(string message, Exception innerException) : base(message
protected AssertionFailure(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
+#endif
}
}
diff --git a/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs b/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs
index 16c7fcd6468..330583ab629 100644
--- a/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs
+++ b/src/NHibernate/Bytecode/AbstractBytecodeProvider.cs
@@ -1,4 +1,5 @@
using System;
+using System.Reflection;
using NHibernate.Properties;
using NHibernate.Util;
@@ -75,7 +76,7 @@ public virtual void SetProxyFactoryFactory(string typeName)
throw new UnableToLoadProxyFactoryFactoryException(typeName, he);
}
- if (typeof(IProxyFactoryFactory).IsAssignableFrom(pffc) == false)
+ if (typeof(IProxyFactoryFactory).GetTypeInfo().IsAssignableFrom(pffc) == false)
{
var he = new HibernateByteCodeException(pffc.FullName + " does not implement " + typeof(IProxyFactoryFactory).FullName);
throw he;
@@ -116,4 +117,4 @@ public void SetCollectionTypeFactoryClass(System.Type type)
#endregion
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate/Bytecode/CodeDom/BytecodeProviderImpl.cs b/src/NHibernate/Bytecode/CodeDom/BytecodeProviderImpl.cs
index 617c218af14..7884c9e83fd 100644
--- a/src/NHibernate/Bytecode/CodeDom/BytecodeProviderImpl.cs
+++ b/src/NHibernate/Bytecode/CodeDom/BytecodeProviderImpl.cs
@@ -1,3 +1,5 @@
+#if FEATURE_CODEDOM
+
using System;
using System.CodeDom.Compiler;
using System.Reflection;
@@ -19,7 +21,7 @@ public class BytecodeProviderImpl : AbstractBytecodeProvider
public override IReflectionOptimizer GetReflectionOptimizer(System.Type clazz, IGetter[] getters, ISetter[] setters)
{
- if (clazz.IsValueType)
+ if (clazz.GetTypeInfo().IsValueType)
{
// Cannot create optimizer for value types - the setter method will not work.
log.Info("Disabling reflection optimizer for value type " + clazz.FullName);
@@ -220,7 +222,7 @@ private string GenerateCode()
{
System.Type type = getters[i].ReturnType;
- if (type.IsValueType)
+ if (type.GetTypeInfo().IsValueType)
{
sb.AppendFormat(" t.{0} = values[{2}] == null ? new {1}() : ({1})values[{2}];\n", setter.PropertyName,
type.FullName.Replace('+', '.'), i);
@@ -261,4 +263,6 @@ private string GenerateCode()
#endregion
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate/Bytecode/EmitUtil.cs b/src/NHibernate/Bytecode/EmitUtil.cs
index 4a73a594ba5..49e78a336ab 100644
--- a/src/NHibernate/Bytecode/EmitUtil.cs
+++ b/src/NHibernate/Bytecode/EmitUtil.cs
@@ -62,7 +62,7 @@ public static void EmitFastInt(ILGenerator il, int value)
public static void EmitBoxIfNeeded(ILGenerator il, System.Type type)
{
- if (type.IsValueType)
+ if (type.GetTypeInfo().IsValueType)
{
il.Emit(OpCodes.Box, type);
}
@@ -103,7 +103,7 @@ static EmitUtil()
public static void PreparePropertyForSet(ILGenerator il, System.Type propertyType)
{
// If this is a value type, we need to unbox it
- if (propertyType.IsValueType)
+ if (propertyType.GetTypeInfo().IsValueType)
{
// if (object[i] == null), create a new instance
Label notNullLabel = il.DefineLabel();
@@ -179,7 +179,7 @@ public static System.Type DefineDelegateType(
methodBuilder.SetImplementationFlags(
MethodImplAttributes.Runtime | MethodImplAttributes.Managed);
- return delegateBuilder.CreateType();
+ return delegateBuilder.CreateTypeInfo().AsType();
}
public static void EmitLoadType(ILGenerator il, System.Type type)
@@ -201,8 +201,11 @@ public static void EmitLoadMethodInfo(ILGenerator il, MethodInfo methodInfo)
public static void EmitCreateDelegateInstance(ILGenerator il, System.Type delegateType, MethodInfo methodInfo)
{
MethodInfo createDelegate = typeof(Delegate).GetMethod(
- "CreateDelegate", BindingFlags.Static | BindingFlags.Public | BindingFlags.ExactBinding, null,
- new System.Type[] {typeof(System.Type), typeof(MethodInfo)}, null);
+ "CreateDelegate", BindingFlags.Static | BindingFlags.Public
+#if !NETSTANDARD
+ | BindingFlags.ExactBinding
+#endif
+ , null, new System.Type[] {typeof(System.Type), typeof(MethodInfo)}, null);
EmitLoadType(il, delegateType);
EmitLoadMethodInfo(il, methodInfo);
@@ -210,4 +213,4 @@ public static void EmitCreateDelegateInstance(ILGenerator il, System.Type delega
il.Emit(OpCodes.Castclass, delegateType);
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate/Bytecode/HibernateByteCodeException.cs b/src/NHibernate/Bytecode/HibernateByteCodeException.cs
index 803765f88a7..8b9d5b89599 100644
--- a/src/NHibernate/Bytecode/HibernateByteCodeException.cs
+++ b/src/NHibernate/Bytecode/HibernateByteCodeException.cs
@@ -1,5 +1,8 @@
using System;
+
+#if FEATURE_SERIALIZATION
using System.Runtime.Serialization;
+#endif
namespace NHibernate.Bytecode
{
@@ -10,6 +13,8 @@ public HibernateByteCodeException() {}
public HibernateByteCodeException(string message) : base(message) {}
public HibernateByteCodeException(string message, Exception inner) : base(message, inner) {}
+#if FEATURE_SERIALIZATION
protected HibernateByteCodeException(SerializationInfo info, StreamingContext context) : base(info, context) {}
+#endif
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate/Bytecode/Lightweight/ReflectionOptimizer.cs b/src/NHibernate/Bytecode/Lightweight/ReflectionOptimizer.cs
index c50a63fc71e..19e18ed2dea 100644
--- a/src/NHibernate/Bytecode/Lightweight/ReflectionOptimizer.cs
+++ b/src/NHibernate/Bytecode/Lightweight/ReflectionOptimizer.cs
@@ -1,10 +1,13 @@
using System.Reflection;
using System.Reflection.Emit;
using System.Security;
-using System.Security.Permissions;
using NHibernate.Properties;
using NHibernate.Util;
+#if FEATURE_SECURITY_PERMISSIONS
+using System.Security.Permissions;
+#endif
+
namespace NHibernate.Bytecode.Lightweight
{
public class ReflectionOptimizer : IReflectionOptimizer, IInstantiationOptimizer
@@ -36,7 +39,7 @@ public ReflectionOptimizer(System.Type mappedType, IGetter[] getters, ISetter[]
{
// save off references
this.mappedType = mappedType;
- typeOfThis = mappedType.IsValueType ? mappedType.MakeByRefType() : mappedType;
+ typeOfThis = mappedType.GetTypeInfo().IsValueType ? mappedType.MakeByRefType() : mappedType;
//this.getters = getters;
//this.setters = setters;
@@ -54,7 +57,7 @@ public ReflectionOptimizer(System.Type mappedType, IGetter[] getters, ISetter[]
///
protected virtual CreateInstanceInvoker CreateCreateInstanceMethod(System.Type type)
{
- if (type.IsInterface || type.IsAbstract)
+ if (type.GetTypeInfo().IsInterface || type.GetTypeInfo().IsAbstract)
{
return null;
}
@@ -63,7 +66,7 @@ protected virtual CreateInstanceInvoker CreateCreateInstanceMethod(System.Type t
ILGenerator il = method.GetILGenerator();
- if (type.IsValueType)
+ if (type.GetTypeInfo().IsValueType)
{
LocalBuilder tmpLocal = il.DeclareLocal(type);
il.Emit(OpCodes.Ldloca, tmpLocal);
@@ -99,16 +102,20 @@ protected virtual void ThrowExceptionForNoDefaultCtor(System.Type type)
protected DynamicMethod CreateDynamicMethod(System.Type returnType, System.Type[] argumentTypes)
{
- System.Type owner = mappedType.IsInterface ? typeof (object) : mappedType;
+ System.Type owner = mappedType.GetTypeInfo().IsInterface ? typeof (object) : mappedType;
+#if FEATURE_SECURITY_PERMISSIONS
#pragma warning disable 618
bool canSkipChecks = SecurityManager.IsGranted(new ReflectionPermission(ReflectionPermissionFlag.MemberAccess));
#pragma warning restore 618
+#else
+ bool canSkipChecks = false;
+#endif
return new DynamicMethod(string.Empty, returnType, argumentTypes, owner, canSkipChecks);
}
private static void EmitCastToReference(ILGenerator il, System.Type type)
{
- if (type.IsValueType)
+ if (type.GetTypeInfo().IsValueType)
{
il.Emit(OpCodes.Unbox, type);
}
diff --git a/src/NHibernate/Bytecode/UnableToLoadProxyFactoryFactoryException.cs b/src/NHibernate/Bytecode/UnableToLoadProxyFactoryFactoryException.cs
index d432c6310b2..f6e2bd1f3a9 100644
--- a/src/NHibernate/Bytecode/UnableToLoadProxyFactoryFactoryException.cs
+++ b/src/NHibernate/Bytecode/UnableToLoadProxyFactoryFactoryException.cs
@@ -1,5 +1,8 @@
using System;
+
+#if FEATURE_SERIALIZATION
using System.Runtime.Serialization;
+#endif
namespace NHibernate.Bytecode
{
@@ -13,8 +16,11 @@ public UnableToLoadProxyFactoryFactoryException(string typeName, Exception inner
this.typeName = typeName;
}
+#if FEATURE_SERIALIZATION
protected UnableToLoadProxyFactoryFactoryException(SerializationInfo info,
StreamingContext context) : base(info, context) {}
+#endif
+
public override string Message
{
get
@@ -34,4 +40,4 @@ public override string Message
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate/Cache/CacheException.cs b/src/NHibernate/Cache/CacheException.cs
index bb36a8bf039..153893b7a96 100644
--- a/src/NHibernate/Cache/CacheException.cs
+++ b/src/NHibernate/Cache/CacheException.cs
@@ -1,5 +1,8 @@
using System;
+
+#if FEATURE_SERIALIZATION
using System.Runtime.Serialization;
+#endif
namespace NHibernate.Cache
{
@@ -49,6 +52,7 @@ public CacheException(string message, Exception innerException) : base(message,
{
}
+#if FEATURE_SERIALIZATION
///
/// Initializes a new instance of the class
/// with serialized data.
@@ -63,5 +67,6 @@ public CacheException(string message, Exception innerException) : base(message,
protected CacheException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
+#endif
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate/Cache/UpdateTimestampsCache.cs b/src/NHibernate/Cache/UpdateTimestampsCache.cs
index 2cd954a0b7f..406d00638ed 100644
--- a/src/NHibernate/Cache/UpdateTimestampsCache.cs
+++ b/src/NHibernate/Cache/UpdateTimestampsCache.cs
@@ -33,66 +33,72 @@ public UpdateTimestampsCache(Settings settings, IDictionary prop
updateTimestamps = settings.CacheProvider.BuildCache(regionName, props);
}
- [MethodImpl(MethodImplOptions.Synchronized)]
public void PreInvalidate(object[] spaces)
{
- //TODO: to handle concurrent writes correctly, this should return a Lock to the client
- long ts = updateTimestamps.NextTimestamp() + updateTimestamps.Timeout;
- for (int i = 0; i < spaces.Length; i++)
+ lock (this)
{
- updateTimestamps.Put(spaces[i], ts);
+ //TODO: to handle concurrent writes correctly, this should return a Lock to the client
+ long ts = updateTimestamps.NextTimestamp() + updateTimestamps.Timeout;
+ for (int i = 0; i < spaces.Length; i++)
+ {
+ updateTimestamps.Put(spaces[i], ts);
+ }
+ //TODO: return new Lock(ts);
}
- //TODO: return new Lock(ts);
}
///
- [MethodImpl(MethodImplOptions.Synchronized)]
public void Invalidate(object[] spaces)
{
- //TODO: to handle concurrent writes correctly, the client should pass in a Lock
- long ts = updateTimestamps.NextTimestamp();
- //TODO: if lock.getTimestamp().equals(ts)
- for (int i = 0; i < spaces.Length; i++)
+ lock (this)
{
- log.Debug(string.Format("Invalidating space [{0}]", spaces[i]));
- updateTimestamps.Put(spaces[i], ts);
+ //TODO: to handle concurrent writes correctly, the client should pass in a Lock
+ long ts = updateTimestamps.NextTimestamp();
+ //TODO: if lock.getTimestamp().equals(ts)
+ for (int i = 0; i < spaces.Length; i++)
+ {
+ log.Debug(string.Format("Invalidating space [{0}]", spaces[i]));
+ updateTimestamps.Put(spaces[i], ts);
+ }
}
}
- [MethodImpl(MethodImplOptions.Synchronized)]
public bool IsUpToDate(ISet spaces, long timestamp /* H2.1 has Long here */)
{
- foreach (string space in spaces)
+ lock (this)
{
- object lastUpdate = updateTimestamps.Get(space);
- if (lastUpdate == null)
+ foreach (string space in spaces)
{
- //the last update timestamp was lost from the cache
- //(or there were no updates since startup!)
+ object lastUpdate = updateTimestamps.Get(space);
+ if (lastUpdate == null)
+ {
+ //the last update timestamp was lost from the cache
+ //(or there were no updates since startup!)
- //NOTE: commented out, since users found the "safe" behavior
- // counter-intuitive when testing, and we couldn't deal
- // with all the forum posts :-(
- //updateTimestamps.put( space, new Long( updateTimestamps.nextTimestamp() ) );
- //result = false; // safer
+ //NOTE: commented out, since users found the "safe" behavior
+ // counter-intuitive when testing, and we couldn't deal
+ // with all the forum posts :-(
+ //updateTimestamps.put( space, new Long( updateTimestamps.nextTimestamp() ) );
+ //result = false; // safer
- //OR: put a timestamp there, to avoid subsequent expensive
- // lookups to a distributed cache - this is no good, since
- // it is non-threadsafe (could hammer effect of an actual
- // invalidation), and because this is not the way our
- // preferred distributed caches work (they work by
- // replication)
- //updateTimestamps.put( space, new Long(Long.MIN_VALUE) );
- }
- else
- {
- if ((long) lastUpdate >= timestamp)
+ //OR: put a timestamp there, to avoid subsequent expensive
+ // lookups to a distributed cache - this is no good, since
+ // it is non-threadsafe (could hammer effect of an actual
+ // invalidation), and because this is not the way our
+ // preferred distributed caches work (they work by
+ // replication)
+ //updateTimestamps.put( space, new Long(Long.MIN_VALUE) );
+ }
+ else
{
- return false;
+ if ((long) lastUpdate >= timestamp)
+ {
+ return false;
+ }
}
}
+ return true;
}
- return true;
}
public void Destroy()
diff --git a/src/NHibernate/CallbackException.cs b/src/NHibernate/CallbackException.cs
index a0b3441eacc..55bc496e66c 100644
--- a/src/NHibernate/CallbackException.cs
+++ b/src/NHibernate/CallbackException.cs
@@ -1,5 +1,8 @@
using System;
+
+#if FEATURE_SERIALIZATION
using System.Runtime.Serialization;
+#endif
namespace NHibernate
{
@@ -40,6 +43,7 @@ public CallbackException(string message, Exception innerException) : base(messag
{
}
+#if FEATURE_SERIALIZATION
///
/// Initializes a new instance of the class
/// with serialized data.
@@ -54,5 +58,6 @@ public CallbackException(string message, Exception innerException) : base(messag
protected CallbackException(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
+#endif
}
}
diff --git a/src/NHibernate/Cfg/Configuration.cs b/src/NHibernate/Cfg/Configuration.cs
index 06d1a168ee4..36b03a9a906 100644
--- a/src/NHibernate/Cfg/Configuration.cs
+++ b/src/NHibernate/Cfg/Configuration.cs
@@ -1,12 +1,10 @@
using System;
using System.Collections;
using System.Collections.Generic;
-using System.Configuration;
using System.Diagnostics;
using System.IO;
using System.Linq;
using System.Reflection;
-using System.Security;
using System.Text;
using System.Xml;
using System.Xml.Schema;
@@ -25,11 +23,22 @@
using NHibernate.Impl;
using NHibernate.Mapping;
using NHibernate.Proxy;
-using NHibernate.Tool.hbm2ddl;
using NHibernate.Type;
using NHibernate.Util;
using Array = System.Array;
+
+#if FEATURE_SYSTEM_CONFIGURATION
+using System.Configuration;
+#endif
+
+#if FEATURE_SERIALIZATION
using System.Runtime.Serialization;
+using System.Security;
+#endif
+
+#if FEATURE_DATA_GETSCHEMATABLE
+using NHibernate.Tool.hbm2ddl;
+#endif
namespace NHibernate.Cfg
{
@@ -49,7 +58,10 @@ namespace NHibernate.Cfg
///
///
[Serializable]
- public class Configuration : ISerializable
+ public class Configuration
+#if FEATURE_SERIALIZATION
+ : ISerializable
+#endif
{
/// Default name for hibernate configuration file.
public const string DefaultHibernateCfgFileName = "hibernate.cfg.xml";
@@ -80,6 +92,7 @@ public class Configuration : ISerializable
protected internal SettingsFactory settingsFactory;
+#if FEATURE_SERIALIZATION
#region ISerializable Members
public Configuration(SerializationInfo info, StreamingContext context)
{
@@ -156,6 +169,7 @@ public void GetObjectData(SerializationInfo info, StreamingContext context)
info.AddValue("filtersSecondPasses", filtersSecondPasses);
}
#endregion
+#endif
///
/// Clear the internal state of the object.
@@ -350,25 +364,20 @@ private static void LogAndThrow(Exception exception)
public Configuration AddXmlFile(string xmlFile)
{
log.Info("Mapping file: " + xmlFile);
- XmlTextReader textReader = null;
- try
- {
- textReader = new XmlTextReader(xmlFile);
- AddXmlReader(textReader, xmlFile);
- }
- catch (MappingException)
+ using (TextReader streamReader = File.OpenText(xmlFile))
+ using (XmlReader textReader = XmlReader.Create(streamReader))
{
- throw;
- }
- catch (Exception e)
- {
- LogAndThrow(new MappingException("Could not configure datastore from file " + xmlFile, e));
- }
- finally
- {
- if (textReader != null)
+ try
+ {
+ AddXmlReader(textReader, xmlFile);
+ }
+ catch (MappingException)
+ {
+ throw;
+ }
+ catch (Exception e)
{
- textReader.Close();
+ LogAndThrow(new MappingException("Could not configure datastore from file " + xmlFile, e));
}
}
return this;
@@ -392,28 +401,23 @@ public Configuration AddXml(string xml, string name)
{
log.Debug("Mapping XML:\n" + xml);
}
- XmlTextReader reader = null;
- try
+ using (TextReader textReader = new StringReader(xml))
+ using (XmlReader reader = XmlReader.Create(textReader))
{
- reader = new XmlTextReader(xml, XmlNodeType.Document, null);
- // make a StringReader for the string passed in - the StringReader
- // inherits from TextReader. We can use the XmlTextReader.ctor that
- // takes the TextReader to build from a string...
- AddXmlReader(reader, name);
- }
- catch (MappingException)
- {
- throw;
- }
- catch (Exception e)
- {
- LogAndThrow(new MappingException("Could not configure datastore from XML string " + name, e));
- }
- finally
- {
- if (reader != null)
+ try
{
- reader.Close();
+ // make a StringReader for the string passed in - the StringReader
+ // inherits from TextReader. We can use the XmlTextReader.ctor that
+ // takes the TextReader to build from a string...
+ AddXmlReader(reader, name);
+ }
+ catch (MappingException)
+ {
+ throw;
+ }
+ catch (Exception e)
+ {
+ LogAndThrow(new MappingException("Could not configure datastore from XML string " + name, e));
}
}
return this;
@@ -626,27 +630,21 @@ public Configuration AddInputStream(Stream xmlInputStream)
///
public Configuration AddInputStream(Stream xmlInputStream, string name)
{
- XmlTextReader textReader = null;
- try
- {
- textReader = new XmlTextReader(xmlInputStream);
- AddXmlReader(textReader, name);
- return this;
- }
- catch (MappingException)
+ using (XmlReader textReader = XmlReader.Create(xmlInputStream))
{
- throw;
- }
- catch (Exception e)
- {
- LogAndThrow(new MappingException("Could not configure datastore from input stream " + name, e));
- return this; // To please the compiler
- }
- finally
- {
- if (textReader != null)
+ try
+ {
+ AddXmlReader(textReader, name);
+ return this;
+ }
+ catch (MappingException)
{
- textReader.Close();
+ throw;
+ }
+ catch (Exception e)
+ {
+ LogAndThrow(new MappingException("Could not configure datastore from input stream " + name, e));
+ return this; // To please the compiler
}
}
}
@@ -661,30 +659,25 @@ public Configuration AddResource(string path, Assembly assembly)
{
string debugName = path;
log.Info("Mapping resource: " + debugName);
- Stream rsrc = assembly.GetManifestResourceStream(path);
- if (rsrc == null)
+ using (Stream rsrc = assembly.GetManifestResourceStream(path))
{
- LogAndThrow(new MappingException("Resource not found: " + debugName));
- }
+ if (rsrc == null)
+ {
+ LogAndThrow(new MappingException("Resource not found: " + debugName));
+ }
- try
- {
- return AddInputStream(rsrc, debugName);
- }
- catch (MappingException)
- {
- throw;
- }
- catch (Exception e)
- {
- LogAndThrow(new MappingException("Could not configure datastore from resource " + debugName, e));
- return this; // To please the compiler
- }
- finally
- {
- if (rsrc != null)
+ try
+ {
+ return AddInputStream(rsrc, debugName);
+ }
+ catch (MappingException)
+ {
+ throw;
+ }
+ catch (Exception e)
{
- rsrc.Close();
+ LogAndThrow(new MappingException("Could not configure datastore from resource " + debugName, e));
+ return this; // To please the compiler
}
}
}
@@ -722,7 +715,7 @@ public Configuration AddResources(IEnumerable paths, Assembly assembly)
///
public Configuration AddClass(System.Type persistentClass)
{
- return AddResource(persistentClass.FullName + ".hbm.xml", persistentClass.Assembly);
+ return AddResource(persistentClass.FullName + ".hbm.xml", persistentClass.GetTypeInfo().Assembly);
}
///
@@ -742,7 +735,7 @@ public Configuration AddAssembly(string assemblyName)
Assembly assembly = null;
try
{
- assembly = Assembly.Load(assemblyName);
+ assembly = Assembly.Load(new AssemblyName(assemblyName));
}
catch (Exception e)
{
@@ -1252,8 +1245,10 @@ public ISessionFactory BuildSessionFactory()
Environment.VerifyProperties(properties);
Settings settings = BuildSettings();
+#if FEATURE_XML_SCHEMAS
// Ok, don't need schemas anymore, so free them
Schemas = null;
+#endif
return new SessionFactoryImpl(this, mapping, settings, GetInitializedEventListeners());
}
@@ -1427,12 +1422,14 @@ private void AddProperties(ISessionFactoryConfiguration factoryConfiguration)
///
public Configuration Configure()
{
+#if FEATURE_SYSTEM_CONFIGURATION
var hc = ConfigurationManager.GetSection(CfgXmlHelper.CfgSectionName) as IHibernateConfiguration;
if (hc != null && hc.SessionFactory != null)
{
return DoConfigure(hc.SessionFactory);
}
else
+#endif
{
return Configure(GetDefaultConfigurationFilePath());
}
@@ -1459,19 +1456,11 @@ private Configuration Configure(string fileName, bool ignoreSessionFactoryConfig
properties = Environment.Properties;
}
- XmlTextReader reader = null;
- try
+ using (TextReader streamReader = File.OpenText(fileName))
+ using (XmlReader reader = XmlReader.Create(streamReader))
{
- reader = new XmlTextReader(fileName);
return Configure(reader);
}
- finally
- {
- if (reader != null)
- {
- reader.Close();
- }
- }
}
///
@@ -1495,10 +1484,8 @@ public Configuration Configure(Assembly assembly, string resourceName)
throw new HibernateException("Could not configure NHibernate.", new ArgumentNullException("resourceName"));
}
- Stream stream = null;
- try
+ using (Stream stream = assembly.GetManifestResourceStream(resourceName))
{
- stream = assembly.GetManifestResourceStream(resourceName);
if (stream == null)
{
// resource does not exist - throw appropriate exception
@@ -1506,14 +1493,7 @@ public Configuration Configure(Assembly assembly, string resourceName)
+ " in Assembly " + assembly.FullName);
}
- return Configure(new XmlTextReader(stream));
- }
- finally
- {
- if (stream != null)
- {
- stream.Close();
- }
+ return Configure(XmlReader.Create(stream));
}
}
@@ -1566,7 +1546,7 @@ protected Configuration DoConfigure(ISessionFactoryConfiguration factoryConfigur
if (!string.IsNullOrEmpty(mc.Resource) && !string.IsNullOrEmpty(mc.Assembly))
{
log.Debug(factoryConfiguration.Name + "<-" + mc.Resource + " in " + mc.Assembly);
- AddResource(mc.Resource, Assembly.Load(mc.Assembly));
+ AddResource(mc.Resource, Assembly.Load(new AssemblyName(mc.Assembly)));
}
else if (!string.IsNullOrEmpty(mc.Assembly))
{
@@ -1794,8 +1774,16 @@ public void AddSqlFunction(string functionName, ISQLFunction sqlFunction)
/// NamedXmlDocument containing the validated XmlDocument built from the XmlReader.
public NamedXmlDocument LoadMappingDocument(XmlReader hbmReader, string name)
{
- XmlReaderSettings settings = Schemas.CreateMappingReaderSettings();
+ XmlReaderSettings settings =
+#if FEATURE_XML_SCHEMAS
+ Schemas.CreateMappingReaderSettings();
+#else
+ new XmlReaderSettings();
+#endif
+
+#if FEATURE_XML_VALIDATIONEVENTHANDLER
settings.ValidationEventHandler += ValidationHandler;
+#endif
using (XmlReader reader = XmlReader.Create(hbmReader, settings))
{
@@ -1866,19 +1854,26 @@ private void ProcessMappingsQueue()
}
}
+#if FEATURE_XML_VALIDATIONEVENTHANDLER
private void ValidationHandler(object o, ValidationEventArgs args)
{
string message = string.Format("{0}({1},{2}): XML validation error: {3}", currentDocumentName,
args.Exception.LineNumber, args.Exception.LinePosition, args.Exception.Message);
LogAndThrow(new MappingException(message, args.Exception));
}
+#endif
protected virtual string GetDefaultConfigurationFilePath()
{
+#if FEATURE_APPDOMAIN
string baseDir = AppDomain.CurrentDomain.BaseDirectory;
// Note RelativeSearchPath can be null even if the doc say something else; don't remove the check
var searchPath = AppDomain.CurrentDomain.RelativeSearchPath ?? string.Empty;
+#else
+ string baseDir = AppContext.BaseDirectory;
+ var searchPath = string.Empty;
+#endif
string relativeSearchPath = searchPath.Split(';').First();
string binPath = Path.Combine(baseDir, relativeSearchPath);
@@ -1887,6 +1882,7 @@ protected virtual string GetDefaultConfigurationFilePath()
#endregion
+#if FEATURE_XML_SCHEMAS
private XmlSchemas schemas;
private XmlSchemas Schemas
@@ -1894,6 +1890,7 @@ private XmlSchemas Schemas
get { return schemas = schemas ?? new XmlSchemas(); }
set { schemas = value; }
}
+#endif
///
/// Set or clear listener for a given .
@@ -2313,6 +2310,7 @@ private static T[] AppendListeners(T[] existing, T[] listenersToAdd)
return list.ToArray();
}
+#if FEATURE_DATA_GETSCHEMATABLE
///
/// Generate DDL for altering tables
///
@@ -2437,6 +2435,7 @@ public void ValidateSchema(Dialect.Dialect dialect, DatabaseMetadata databaseMet
}
}
}
+#endif
private IEnumerable IterateGenerators(Dialect.Dialect dialect)
{
diff --git a/src/NHibernate/Cfg/ConfigurationSchema/HibernateConfiguration.cs b/src/NHibernate/Cfg/ConfigurationSchema/HibernateConfiguration.cs
index ebe41928873..2608bc57daa 100644
--- a/src/NHibernate/Cfg/ConfigurationSchema/HibernateConfiguration.cs
+++ b/src/NHibernate/Cfg/ConfigurationSchema/HibernateConfiguration.cs
@@ -1,4 +1,5 @@
using System;
+using System.IO;
using System.Xml;
using System.Xml.XPath;
@@ -59,13 +60,21 @@ private HibernateConfiguration(XmlReader hbConfigurationReader, bool fromAppSett
internal static HibernateConfiguration FromAppConfig(XmlNode node)
{
- XmlTextReader reader = new XmlTextReader(node.OuterXml, XmlNodeType.Document, null);
- return new HibernateConfiguration(reader, true);
+ using (TextReader textReader = new StringReader(node.OuterXml))
+ using (XmlReader reader = XmlReader.Create(textReader))
+ {
+ return new HibernateConfiguration(reader, true);
+ }
}
private XmlReaderSettings GetSettings()
{
- XmlReaderSettings xmlrs = (new XmlSchemas()).CreateConfigReaderSettings();
+ XmlReaderSettings xmlrs =
+#if FEATURE_XML_SCHEMAS
+ (new XmlSchemas()).CreateConfigReaderSettings();
+#else
+ new XmlReaderSettings();
+#endif
return xmlrs;
}
diff --git a/src/NHibernate/Cfg/ConfigurationSectionHandler.cs b/src/NHibernate/Cfg/ConfigurationSectionHandler.cs
index 5d3312bc2dc..e986c4c60b9 100644
--- a/src/NHibernate/Cfg/ConfigurationSectionHandler.cs
+++ b/src/NHibernate/Cfg/ConfigurationSectionHandler.cs
@@ -1,3 +1,5 @@
+#if FEATURE_SYSTEM_CONFIGURATION
+
using System;
using System.Configuration;
using System.Xml;
@@ -19,4 +21,6 @@ object IConfigurationSectionHandler.Create(object parent, object configContext,
#endregion
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate/Cfg/Environment.cs b/src/NHibernate/Cfg/Environment.cs
index 9893ebab2d1..6d1e1d36ecc 100644
--- a/src/NHibernate/Cfg/Environment.cs
+++ b/src/NHibernate/Cfg/Environment.cs
@@ -1,12 +1,16 @@
using System;
using System.Collections.Generic;
-using System.Configuration;
+using System.Linq;
using System.Reflection;
using NHibernate.Bytecode;
using NHibernate.Cfg.ConfigurationSchema;
using NHibernate.Util;
+#if FEATURE_SYSTEM_CONFIGURATION
+using System.Configuration;
+#endif
+
namespace NHibernate.Cfg
{
///
@@ -47,10 +51,9 @@ public static string Version
{
if (cachedVersion == null)
{
- Assembly thisAssembly = Assembly.GetExecutingAssembly();
+ Assembly thisAssembly = typeof(Environment).GetTypeInfo().Assembly;
var attrs =
- (AssemblyInformationalVersionAttribute[])
- thisAssembly.GetCustomAttributes(typeof(AssemblyInformationalVersionAttribute), false);
+ thisAssembly.GetCustomAttributes().ToArray();
if (attrs != null && attrs.Length > 0)
{
@@ -233,6 +236,7 @@ static Environment()
private static void LoadGlobalPropertiesFromAppConfig()
{
+#if FEATURE_SYSTEM_CONFIGURATION
object config = ConfigurationManager.GetSection(CfgXmlHelper.CfgSectionName);
if (config == null)
@@ -260,6 +264,7 @@ private static void LoadGlobalPropertiesFromAppConfig()
GlobalProperties[kvp.Key] = kvp.Value;
}
}
+#endif
}
internal static void ResetSessionFactoryProperties()
@@ -343,8 +348,10 @@ private static IBytecodeProvider BuildBytecodeProvider(string providerName)
{
switch (providerName)
{
+#if FEATURE_CODEDOM
case "codedom":
return new Bytecode.CodeDom.BytecodeProviderImpl();
+#endif
case "lcg":
return new Bytecode.Lightweight.BytecodeProviderImpl();
case "null":
diff --git a/src/NHibernate/Cfg/HibernateConfigException.cs b/src/NHibernate/Cfg/HibernateConfigException.cs
index 4b04670b489..d0bf744311f 100644
--- a/src/NHibernate/Cfg/HibernateConfigException.cs
+++ b/src/NHibernate/Cfg/HibernateConfigException.cs
@@ -1,5 +1,8 @@
using System;
+
+#if FEATURE_SERIALIZATION
using System.Runtime.Serialization;
+#endif
namespace NHibernate.Cfg
{
@@ -57,6 +60,7 @@ public HibernateConfigException(string message, Exception innerException)
{
}
+#if FEATURE_SERIALIZATION
///
/// Initializes a new instance of the class
/// with serialized data.
@@ -72,5 +76,6 @@ protected HibernateConfigException(SerializationInfo info, StreamingContext cont
: base(info, context)
{
}
+#endif
}
}
diff --git a/src/NHibernate/Cfg/Mappings.cs b/src/NHibernate/Cfg/Mappings.cs
index ac1ab902233..6d1067b4fb4 100644
--- a/src/NHibernate/Cfg/Mappings.cs
+++ b/src/NHibernate/Cfg/Mappings.cs
@@ -538,7 +538,7 @@ public void AddColumnBinding(string logicalName, Column finalColumn, Table table
if (oldFinalName != null &&
!(finalColumn.IsQuoted
? oldFinalName.Equals(finalColumn.GetQuotedName())
- : oldFinalName.Equals(finalColumn.GetQuotedName(), StringComparison.InvariantCultureIgnoreCase)))
+ : oldFinalName.Equals(finalColumn.GetQuotedName(), StringComparison.OrdinalIgnoreCase)))
{
//TODO possibly relax that
throw new MappingException("Same logical column name referenced by different physical ones: " + table.Name + "."
diff --git a/src/NHibernate/Cfg/MappingsQueue.cs b/src/NHibernate/Cfg/MappingsQueue.cs
index b14e10526eb..d3da7c86d9e 100644
--- a/src/NHibernate/Cfg/MappingsQueue.cs
+++ b/src/NHibernate/Cfg/MappingsQueue.cs
@@ -1,4 +1,3 @@
-using System.Collections;
using System.Collections.Generic;
using System.Linq;
using System.Text;
@@ -10,7 +9,7 @@ namespace NHibernate.Cfg
///
public class MappingsQueue
{
- private readonly Queue availableEntries = new Queue();
+ private readonly Queue availableEntries = new Queue();
private readonly ISet processedClassNames = new HashSet();
private readonly List unavailableEntries = new List();
@@ -109,4 +108,4 @@ private static string FormatExceptionMessage(IEnumerable res
return message.ToString();
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate/Cfg/SettingsFactory.cs b/src/NHibernate/Cfg/SettingsFactory.cs
index 502a0dc4e4d..4404ba837e4 100644
--- a/src/NHibernate/Cfg/SettingsFactory.cs
+++ b/src/NHibernate/Cfg/SettingsFactory.cs
@@ -394,7 +394,13 @@ private static System.Type CreateLinqQueryProviderType(IDictionary properties)
{
string className = PropertiesHelper.GetString(
- Environment.TransactionStrategy, properties, typeof(AdoNetWithDistributedTransactionFactory).FullName);
+ Environment.TransactionStrategy, properties
+#if FEATURE_SYSTEM_TRANSACTIONS
+ , typeof(AdoNetWithDistributedTransactionFactory).FullName
+#else
+ , typeof(AdoNetTransactionFactory).FullName // No distributed transactions for .NET Core
+#endif
+ );
log.Info("Transaction factory: " + className);
try
diff --git a/src/NHibernate/Cfg/XmlHbmBinding/CollectionBinder.cs b/src/NHibernate/Cfg/XmlHbmBinding/CollectionBinder.cs
index 7353478d59d..3539d71ccf2 100644
--- a/src/NHibernate/Cfg/XmlHbmBinding/CollectionBinder.cs
+++ b/src/NHibernate/Cfg/XmlHbmBinding/CollectionBinder.cs
@@ -1,6 +1,7 @@
using System;
using System.Collections.Generic;
using System.Linq;
+using System.Reflection;
using NHibernate.Mapping;
using NHibernate.Type;
using NHibernate.Util;
@@ -230,7 +231,7 @@ private void BindCollection(ICollectionPropertiesMapping collectionMapping, Mapp
if (!isGeneric.HasValue && containingType != null)
{
collectionType = GetPropertyType(containingType, collectionMapping.Name, collectionMapping.Access);
- isGeneric = collectionType.IsGenericType;
+ isGeneric = collectionType.GetTypeInfo().IsGenericType;
}
model.IsGeneric = isGeneric.GetValueOrDefault();
diff --git a/src/NHibernate/Cfg/XmlHbmBinding/ColumnsBinder.cs b/src/NHibernate/Cfg/XmlHbmBinding/ColumnsBinder.cs
index 3a06592157b..71db954a111 100644
--- a/src/NHibernate/Cfg/XmlHbmBinding/ColumnsBinder.cs
+++ b/src/NHibernate/Cfg/XmlHbmBinding/ColumnsBinder.cs
@@ -76,7 +76,7 @@ private static void BindIndex(string indexAttribute, Table table, Column column)
if (indexAttribute != null && table != null)
{
var tokens = indexAttribute.Split(',');
- System.Array.ForEach(tokens, t => table.GetOrCreateIndex(t.Trim()).AddColumn(column));
+ tokens.ForEach(t => table.GetOrCreateIndex(t.Trim()).AddColumn(column));
}
}
@@ -85,8 +85,8 @@ private static void BindUniqueKey(string uniqueKeyAttribute, Table table, Column
if (uniqueKeyAttribute != null && table != null)
{
var tokens = uniqueKeyAttribute.Split(',');
- System.Array.ForEach(tokens, t => table.GetOrCreateUniqueKey(t.Trim()).AddColumn(column));
+ tokens.ForEach(t => table.GetOrCreateUniqueKey(t.Trim()).AddColumn(column));
}
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs b/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs
index a68eef4fbad..a5b301f579d 100644
--- a/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs
+++ b/src/NHibernate/Cfg/XmlHbmBinding/MappingRootBinder.cs
@@ -109,13 +109,13 @@ private void AddSubclasses(HbmSubclass subClass, IDictionary properties, Table table, ID
}
else if ((anyMapping = entityPropertyMapping as HbmAny) != null)
{
+#if FEATURE_SERIALIZATION
var value = new Any(table);
BindAny(anyMapping, value, true);
property = CreateProperty(entityPropertyMapping, className, value, inheritedMetas);
BindAnyProperty(anyMapping, property);
+#else
+ throw new NotImplementedException(string.Format("HbmAny not valid in .NET Core for property {0}", anyMapping.Name));
+#endif
}
else if ((nestedCompositeElementMapping = entityPropertyMapping as HbmNestedCompositeElement) != null)
{
@@ -361,12 +365,13 @@ private void BindComponentProperty(HbmComponent componentMapping, Property prope
HbmTuplizer[] tuplizers = componentMapping.tuplizer;
if (tuplizers != null)
{
- Array.ForEach(tuplizers.Select(tuplizer => new
- {
- TuplizerClassName = FullQualifiedClassName(tuplizer.@class, mappings),
- Mode = tuplizer.entitymode.ToEntityMode()
- }).ToArray(),
- x => model.AddTuplizer(x.Mode, x.TuplizerClassName));
+ tuplizers.Select(
+ tuplizer => new
+ {
+ TuplizerClassName = FullQualifiedClassName(tuplizer.@class, mappings),
+ Mode = tuplizer.entitymode.ToEntityMode()
+ })
+ .ForEach(x => model.AddTuplizer(x.Mode, x.TuplizerClassName));
}
}
@@ -421,4 +426,4 @@ private string GetPropertyAccessorName(string propertyMappedAccessor)
return propertyMappedAccessor ?? Mappings.DefaultAccess;
}
}
-}
\ No newline at end of file
+}
diff --git a/src/NHibernate/Cfg/XmlHbmBinding/TypeBinder.cs b/src/NHibernate/Cfg/XmlHbmBinding/TypeBinder.cs
index 07bcf480478..02021912a03 100644
--- a/src/NHibernate/Cfg/XmlHbmBinding/TypeBinder.cs
+++ b/src/NHibernate/Cfg/XmlHbmBinding/TypeBinder.cs
@@ -44,7 +44,7 @@ public void Bind(HbmType typeMapping)
var parameters = new Dictionary();
if(typeMapping.param != null)
{
- System.Array.ForEach(typeMapping.param, p => parameters[p.name] = p.Text.LinesToString());
+ typeMapping.param.ForEach(p => parameters[p.name] = p.Text.LinesToString());
}
BindThroughTypeDefOrType(originalTypeName, parameters);
@@ -83,4 +83,4 @@ private void BindThroughTypeDefOrType(string originalTypeName, IDictionary
/// Initializes a new instance of the class
/// with serialized data.
@@ -64,5 +68,6 @@ public ValidationFailure(string message, Exception innerException) : base(messag
protected ValidationFailure(SerializationInfo info, StreamingContext context) : base(info, context)
{
}
+#endif
}
}
diff --git a/src/NHibernate/Compat/AppContext.cs b/src/NHibernate/Compat/AppContext.cs
new file mode 100644
index 00000000000..dd7cedc6936
--- /dev/null
+++ b/src/NHibernate/Compat/AppContext.cs
@@ -0,0 +1,13 @@
+#if NET_4_0
+namespace System
+{
+ internal static class AppContext
+ {
+ /// Gets the pathname of the base directory that the assembly resolver uses to probe for assemblies.
+ public static string BaseDirectory
+ {
+ get { return AppDomain.CurrentDomain.BaseDirectory; }
+ }
+ }
+}
+#endif
diff --git a/src/NHibernate/Compat/DesignerCategoryAttribute.cs b/src/NHibernate/Compat/DesignerCategoryAttribute.cs
new file mode 100644
index 00000000000..c88655b2035
--- /dev/null
+++ b/src/NHibernate/Compat/DesignerCategoryAttribute.cs
@@ -0,0 +1,13 @@
+#if NETSTANDARD
+// ReSharper disable once CheckNamespace
+namespace System.ComponentModel
+{
+ [AttributeUsage(AttributeTargets.Class, AllowMultiple = false, Inherited = true)]
+ internal class DesignerCategoryAttribute : Attribute
+ {
+ public DesignerCategoryAttribute(string category)
+ {
+ }
+ }
+}
+#endif
diff --git a/src/NHibernate/Compat/ICloneable.cs b/src/NHibernate/Compat/ICloneable.cs
new file mode 100644
index 00000000000..2ab0becc7fd
--- /dev/null
+++ b/src/NHibernate/Compat/ICloneable.cs
@@ -0,0 +1,11 @@
+#if FEATURE_NETCORE_ICLONEABLE_API
+// ReSharper disable once CheckNamespace
+namespace System
+{
+ public interface ICloneable
+ {
+ object Clone();
+ }
+}
+#endif
+
diff --git a/src/NHibernate/Compat/InvalidExpressionException.cs b/src/NHibernate/Compat/InvalidExpressionException.cs
new file mode 100644
index 00000000000..3599a256912
--- /dev/null
+++ b/src/NHibernate/Compat/InvalidExpressionException.cs
@@ -0,0 +1,22 @@
+#if NETSTANDARD
+// ReSharper disable once CheckNamespace
+namespace System.Data
+{
+ public class InvalidExpressionException : System.Exception
+ {
+ public InvalidExpressionException()
+ {
+ }
+
+ public InvalidExpressionException(string s)
+ : base(s)
+ {
+ }
+
+ public InvalidExpressionException(string message, Exception innerException)
+ : base(message, innerException)
+ {
+ }
+ }
+}
+#endif
diff --git a/src/NHibernate/Compat/NonSerializedAttribute.cs b/src/NHibernate/Compat/NonSerializedAttribute.cs
new file mode 100644
index 00000000000..05107a66013
--- /dev/null
+++ b/src/NHibernate/Compat/NonSerializedAttribute.cs
@@ -0,0 +1,10 @@
+#if !FEATURE_SERIALIZATION && NETSTANDARD
+// ReSharper disable once CheckNamespace
+namespace System
+{
+ [AttributeUsage(AttributeTargets.Field, Inherited = false)]
+ internal sealed class NonSerializedAttribute : Attribute
+ {
+ }
+}
+#endif
diff --git a/src/NHibernate/Compat/SerializableAttribute.cs b/src/NHibernate/Compat/SerializableAttribute.cs
new file mode 100644
index 00000000000..e12a812f14f
--- /dev/null
+++ b/src/NHibernate/Compat/SerializableAttribute.cs
@@ -0,0 +1,10 @@
+#if !FEATURE_SERIALIZATION && NETSTANDARD
+// ReSharper disable once CheckNamespace
+namespace System
+{
+ [AttributeUsage(AttributeTargets.Class | AttributeTargets.Struct | AttributeTargets.Enum | AttributeTargets.Delegate, Inherited = false)]
+ internal sealed class SerializableAttribute : Attribute
+ {
+ }
+}
+#endif
diff --git a/src/NHibernate/Compat/TypeReflectionExtensions.cs b/src/NHibernate/Compat/TypeReflectionExtensions.cs
new file mode 100644
index 00000000000..9e174dd0984
--- /dev/null
+++ b/src/NHibernate/Compat/TypeReflectionExtensions.cs
@@ -0,0 +1,43 @@
+#if FEATURE_NETCORE_REFLECTION_API
+
+using System.Collections.Generic;
+using System.Linq;
+using System.Reflection;
+
+namespace NHibernate
+{
+ internal static class TypeReflectionExtensions
+ {
+ public static MethodInfo GetMethod(this System.Type type, string name, BindingFlags bindingAttr, object binder,
+ System.Type[] types, ParameterModifier[] modifiers)
+ {
+ return type.GetMethods(bindingAttr)
+ .FirstOrDefault(m => m.Name == name && m.GetParameters().Select(p => p.ParameterType).SequenceEqual(types));
+ }
+
+ public static PropertyInfo GetProperty(this System.Type type, string name, BindingFlags bindingAttr, System.Type returnType, object binder,
+ System.Type[] types, ParameterModifier[] modifiers)
+ {
+ return type.GetProperties(bindingAttr)
+ .FirstOrDefault(m => m.Name == name
+ && (returnType == null || m.PropertyType == returnType)
+ && (type == null || m.GetIndexParameters().Select(p => p.ParameterType).SequenceEqual(types)));
+ }
+
+ public static ConstructorInfo GetConstructor(this System.Type type, BindingFlags bindingAttr, object binder,
+ System.Type[] types, ParameterModifier[] modifiers)
+ {
+ return type.GetConstructors(bindingAttr)
+ .FirstOrDefault(m => m.GetParameters().Select(p => p.ParameterType).SequenceEqual(types));
+ }
+
+ public static ConstructorInfo GetConstructor(this System.Type type, BindingFlags bindingAttr, object binder,
+ CallingConventions callingConventions, System.Type[] types, ParameterModifier[] modifiers)
+ {
+ return type.GetConstructors(bindingAttr)
+ .FirstOrDefault(m => m.CallingConvention.HasFlag(callingConventions) && m.GetParameters().Select(p => p.ParameterType).SequenceEqual(types));
+ }
+ }
+}
+
+#endif
diff --git a/src/NHibernate/Connection/ConnectionProvider.cs b/src/NHibernate/Connection/ConnectionProvider.cs
index 8be053981e8..819b9fa3be1 100644
--- a/src/NHibernate/Connection/ConnectionProvider.cs
+++ b/src/NHibernate/Connection/ConnectionProvider.cs
@@ -1,6 +1,5 @@
using System;
using System.Collections;
-using System.Configuration;
using System.Data.Common;
using NHibernate.Driver;
@@ -8,6 +7,10 @@
using Environment=NHibernate.Cfg.Environment;
using System.Collections.Generic;
+#if FEATURE_SYSTEM_CONFIGURATION
+using System.Configuration;
+#endif
+
namespace NHibernate.Connection
{
///
@@ -73,6 +76,7 @@ public virtual void Configure(IDictionary settings)
///
protected virtual string GetNamedConnectionString(IDictionary settings)
{
+#if FEATURE_SYSTEM_CONFIGURATION
string connStringName;
if(!settings.TryGetValue(Environment.ConnectionStringName, out connStringName))
return null;
@@ -81,6 +85,9 @@ protected virtual string GetNamedConnectionString(IDictionary se
if (connectionStringSettings == null)
throw new HibernateException(string.Format("Could not find named connection string {0}", connStringName));
return connectionStringSettings.ConnectionString;
+#else
+ return null;
+#endif
}
///
diff --git a/src/NHibernate/Context/CallSessionContext.cs b/src/NHibernate/Context/CallSessionContext.cs
index 9b6d2b3ce83..92325cb22ef 100644
--- a/src/NHibernate/Context/CallSessionContext.cs
+++ b/src/NHibernate/Context/CallSessionContext.cs
@@ -1,3 +1,5 @@
+#if FEATURE_REMOTING
+
using System;
using System.Collections;
using System.Runtime.Remoting.Messaging;
@@ -36,4 +38,6 @@ protected override IDictionary GetMap()
return CallContext.GetData(SessionFactoryMapKey) as IDictionary;
}
}
-}
\ No newline at end of file
+}
+
+#endif
diff --git a/src/NHibernate/Context/ReflectiveHttpContext.cs b/src/NHibernate/Context/ReflectiveHttpContext.cs
index 72b6adc2230..5004a1810eb 100644
--- a/src/NHibernate/Context/ReflectiveHttpContext.cs
+++ b/src/NHibernate/Context/ReflectiveHttpContext.cs
@@ -1,3 +1,5 @@
+#if FEATURE_WEB_SESSION_CONTEXT
+
using System;
using System.Collections;
using System.Linq.Expressions;
@@ -54,4 +56,6 @@ private static void CreateHttpContextItemsGetter()
HttpContextItemsGetter = (Func