diff --git a/src/NHibernate/Context/WcfOperationSessionContext.cs b/src/NHibernate/Context/WcfOperationSessionContext.cs index ba0e6ad7301..fe0dda21a45 100644 --- a/src/NHibernate/Context/WcfOperationSessionContext.cs +++ b/src/NHibernate/Context/WcfOperationSessionContext.cs @@ -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; @@ -50,3 +56,36 @@ public void Attach(OperationContext owner) { } public void Detach(OperationContext owner) { } } } +#else +// 6.0 TODO: remove the whole #else +using System; +using System.Collections; +using NHibernate.Engine; + +namespace NHibernate.Context +{ + /// + /// 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 + /// + [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) + { + } + } +} +#endif diff --git a/src/NHibernate/Impl/SessionFactoryImpl.cs b/src/NHibernate/Impl/SessionFactoryImpl.cs index 3f90f9d0181..66168743adf 100644 --- a/src/NHibernate/Impl/SessionFactoryImpl.cs +++ b/src/NHibernate/Impl/SessionFactoryImpl.cs @@ -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 diff --git a/src/NHibernate/NHibernate.csproj b/src/NHibernate/NHibernate.csproj index 04cfc0cf258..059a9b91746 100644 --- a/src/NHibernate/NHibernate.csproj +++ b/src/NHibernate/NHibernate.csproj @@ -52,13 +52,11 @@ - -