Skip to content

Commit 9610639

Browse files
committed
NH-3807 - Guard Remoting methods and types and Wcf service model operations
1 parent 034fc7a commit 9610639

File tree

4 files changed

+19
-2
lines changed

4 files changed

+19
-2
lines changed

src/NHibernate/Context/CallSessionContext.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if FEATURE_REMOTING
2+
13
using System;
24
using System.Collections.Generic;
35
using System.Runtime.Remoting.Messaging;
@@ -37,3 +39,5 @@ protected override IDictionary<ISessionFactoryImplementor, ISession> GetMap()
3739
}
3840
}
3941
}
42+
43+
#endif

src/NHibernate/Context/WcfOperationSessionContext.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,3 +1,5 @@
1+
#if FEATURE_SYSTEM_SERVICEMODEL
2+
13
using System;
24
using System.Collections.Generic;
35
using System.ServiceModel;
@@ -50,3 +52,5 @@ public void Attach(OperationContext owner) { }
5052
public void Detach(OperationContext owner) { }
5153
}
5254
}
55+
56+
#endif

src/NHibernate/Impl/SessionFactoryImpl.cs

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1235,14 +1235,18 @@ private ICurrentSessionContext BuildCurrentSessionContext()
12351235
{
12361236
case null:
12371237
return null;
1238+
#if FEATURE_REMOTING
12381239
case "call":
12391240
return new CallSessionContext(this);
1241+
#endif
12401242
case "thread_static":
12411243
return new ThreadStaticSessionContext(this);
12421244
case "web":
12431245
return new WebSessionContext(this);
1246+
#if FEATURE_REMOTING
12441247
case "wcf_operation":
12451248
return new WcfOperationSessionContext(this);
1249+
#endif
12461250
}
12471251

12481252
try

src/NHibernate/Proxy/DefaultDynamicProxyMethodCheckerExtensions.cs

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,9 @@ public static class DefaultDynamicProxyMethodCheckerExtensions
1010
public static bool IsProxiable(this MethodInfo method)
1111
{
1212
return !method.IsFinal
13+
#if FEATURE_REMOTING
1314
&& (method.DeclaringType != typeof(MarshalByRefObject))
15+
#endif
1416
&& (method.DeclaringType != typeof(object) || !"finalize".Equals(method.Name.ToLowerInvariant()))
1517
&&
1618
(
@@ -23,7 +25,10 @@ public static bool IsProxiable(this MethodInfo method)
2325
public static bool ShouldBeProxiable(this MethodInfo method)
2426
{
2527
// to use only for real methods (no getter/setter)
26-
return (method.DeclaringType != typeof (MarshalByRefObject)) &&
28+
return
29+
#if FEATURE_REMOTING
30+
(method.DeclaringType != typeof (MarshalByRefObject)) &&
31+
#endif
2732
(method.DeclaringType != typeof (object) || !"finalize".Equals(method.Name.ToLowerInvariant())) &&
2833
(!(method.DeclaringType == typeof (object) && "GetType".Equals(method.Name))) &&
2934
(!(method.DeclaringType == typeof (object) && "obj_address".Equals(method.Name))) && // Mono-specific method
@@ -48,4 +53,4 @@ private static bool IsDisposeMethod(MethodInfo method)
4853
// return method.Name.Equals("Dispose") && method.IsMethodOf(typeof(IDisposable));
4954
}
5055
}
51-
}
56+
}

0 commit comments

Comments
 (0)