Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Remove WcfOperationSessionContext from .Net Core and .Net Standard #1842

Merged
merged 3 commits into from
Sep 12, 2018
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
41 changes: 40 additions & 1 deletion src/NHibernate/Context/WcfOperationSessionContext.cs
Original file line number Diff line number Diff line change
@@ -1,4 +1,10 @@
using System;
// There is no support of WCF Server under .Net Core, so it makes little sense to provide
// a WCF OperationContext for it. Since it adds additional heavy dependencies, it has been
// considered not desirable to provide it for .Net Standard. (It could be useful in case some
// WCF server becames available in another frameworks or if a .Net Framework application
// consumes the .Net Standard distribution of NHibernate instead of the .Net Framework one.)
// See https://github.com/dotnet/wcf/issues/1200 and #1842
#if NETFX
using System.Collections;
using System.ServiceModel;

Expand Down Expand Up @@ -50,3 +56,36 @@ public void Attach(OperationContext owner) { }
public void Detach(OperationContext owner) { }
}
hazzik marked this conversation as resolved.
Show resolved Hide resolved
}
#else
// 6.0 TODO: remove the whole #else
using System;
using System.Collections;
using NHibernate.Engine;

namespace NHibernate.Context
{
/// <summary>
/// Obsolete class not usable with the current framework. Use the
/// .Net Framework distribution of NHibernate if you need it. See
/// https://github.com/nhibernate/nhibernate-core/issues/1842
/// </summary>
[Obsolete("Not supported in this platform", true)]
public class WcfOperationSessionContext : MapBasedSessionContext
{
public WcfOperationSessionContext(ISessionFactoryImplementor factory) : base(factory)
{
throw new PlatformNotSupportedException(
"WcfOperationSessionContext is not supported for the current framework");
}

protected override IDictionary GetMap()
{
return null;
}

protected override void SetMap(IDictionary value)
{
}
}
}
hazzik marked this conversation as resolved.
Show resolved Hide resolved
#endif
11 changes: 11 additions & 0 deletions src/NHibernate/Impl/SessionFactoryImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1276,7 +1276,18 @@ private ICurrentSessionContext BuildCurrentSessionContext()
case "web":
return new WebSessionContext(this);
case "wcf_operation":
#if NETFX
return new WcfOperationSessionContext(this);
#else
// There is no support of WCF Server under .Net Core, so it makes little sense to provide
// a WCF OperationContext for it. Since it adds additional heavy dependencies, it has been
// considered not desirable to provide it for .Net Standard. (It could be useful in case some
// WCF server becames available in another frameworks or if a .Net Framework application
// consumes the .Net Standard distribution of NHibernate instead of the .Net Framework one.)
// See https://github.com/dotnet/wcf/issues/1200 and #1842
throw new PlatformNotSupportedException(
"WcfOperationSessionContext is not supported for the current framework");
#endif
}

try
Expand Down
2 changes: 0 additions & 2 deletions src/NHibernate/NHibernate.csproj
Original file line number Diff line number Diff line change
Expand Up @@ -52,13 +52,11 @@
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netcoreapp2.0'">
<PackageReference Include="System.ServiceModel.Primitives" Version="4.4.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.1" />
<PackageReference Include="System.Security.Permissions" Version="4.4.1" />
</ItemGroup>

<ItemGroup Condition="'$(TargetFramework)' == 'netstandard2.0'">
<PackageReference Include="System.ServiceModel.Primitives" Version="4.4.0" />
<PackageReference Include="System.Configuration.ConfigurationManager" Version="4.4.1" />
<PackageReference Include="System.Security.Permissions" Version="4.4.1" />
<PackageReference Include="System.Reflection.Emit" Version="4.3.0" />
Expand Down