Skip to content

Remove use of NET_4_0 conditional. Leads to slight code simplification. #539

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

Merged
merged 1 commit into from
Dec 5, 2016
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
6 changes: 1 addition & 5 deletions src/NHibernate/ADOException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -56,11 +56,7 @@ protected ADOException(SerializationInfo info, StreamingContext context) : base(
this.sql = (string) info.GetValue("sql", typeof(string));
}

#if NET_4_0
[SecurityCritical]
#else
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand All @@ -72,4 +68,4 @@ public string SqlString
get { return sql; }
}
}
}
}
4 changes: 0 additions & 4 deletions src/NHibernate/AdoNet/ConnectionManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -282,11 +282,7 @@ private ConnectionManager(SerializationInfo info, StreamingContext context)
interceptor = (IInterceptor)info.GetValue("interceptor", typeof(IInterceptor));
}

#if NET_4_0
[SecurityCritical]
#else
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
#endif
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("ownConnection", ownConnection);
Expand Down
6 changes: 1 addition & 5 deletions src/NHibernate/AdoNet/TooManyRowsAffectedException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -25,11 +25,7 @@ protected TooManyRowsAffectedException(SerializationInfo info, StreamingContext
this.actualRowCount = info.GetInt32("actualRowCount");
}

#if NET_4_0
[SecurityCritical]
#else
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand All @@ -47,4 +43,4 @@ public int ActualRowCount
get { return actualRowCount; }
}
}
}
}
2 changes: 0 additions & 2 deletions src/NHibernate/Cfg/Configuration.cs
Original file line number Diff line number Diff line change
Expand Up @@ -121,9 +121,7 @@ private T GetSerialedObject<T>(SerializationInfo info, string name)
return (T)info.GetValue(name, typeof(T));
}

#if NET_4_0
[SecurityCritical]
#endif
public void GetObjectData(SerializationInfo info, StreamingContext context)
{
ConfigureProxyFactoryFactory();
Expand Down
6 changes: 0 additions & 6 deletions src/NHibernate/Engine/CascadeStyle.cs
Original file line number Diff line number Diff line change
Expand Up @@ -93,9 +93,7 @@ public static CascadeStyle GetCascadeStyle(string cascade)
return style;
}

#if NET_4_0
[SecurityCritical]
#endif
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
string alias = AliasByStyle[this];
Expand All @@ -108,9 +106,7 @@ private sealed class CascadeStyleSingletonReference : IObjectReference, ISeriali
{
private readonly string _cascadeStyle;

#if NET_4_0
[SecurityCritical]
#endif
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
throw new NotImplementedException("This class should not be serialized directly.");
Expand Down Expand Up @@ -270,9 +266,7 @@ private MultipleCascadeStyle(SerializationInfo info, StreamingContext context)
styles = (CascadeStyle[])info.GetValue("styles", typeof(CascadeStyle[]));
}

#if NET_4_0
[SecurityCritical]
#endif
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
info.AddValue("styles", styles);
Expand Down
4 changes: 0 additions & 4 deletions src/NHibernate/Engine/StatefulPersistenceContext.cs
Original file line number Diff line number Diff line change
Expand Up @@ -1495,11 +1495,7 @@ internal StatefulPersistenceContext(SerializationInfo info, StreamingContext con
InitTransientState();
}

#if NET_4_0
[SecurityCritical]
#else
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
#endif
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
log.Debug("serializing persistent-context");
Expand Down
2 changes: 0 additions & 2 deletions src/NHibernate/Impl/SessionFactoryImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -423,9 +423,7 @@ public EventListeners EventListeners

#region IObjectReference Members

#if NET_4_0
[SecurityCritical]
#endif
public object GetRealObject(StreamingContext context)
{
// the SessionFactory that was serialized only has values in the properties
Expand Down
4 changes: 0 additions & 4 deletions src/NHibernate/Impl/SessionImpl.cs
Original file line number Diff line number Diff line change
Expand Up @@ -133,11 +133,7 @@ private SessionImpl(SerializationInfo info, StreamingContext context)
/// has complete control and what is serialized and those attributes are ignored. However,
/// this method should be in sync with the attributes for easy readability.
/// </remarks>
#if NET_4_0
[SecurityCritical]
#else
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
#endif
void ISerializable.GetObjectData(SerializationInfo info, StreamingContext context)
{
log.Debug("writting session to serializer");
Expand Down
6 changes: 1 addition & 5 deletions src/NHibernate/InstantiationException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -90,11 +90,7 @@ protected InstantiationException(SerializationInfo info, StreamingContext contex
/// <param name="context">
/// The <see cref="StreamingContext"/> that contains contextual information about the source or destination.
/// </param>
#if NET_4_0
[SecurityCritical]
#else
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand All @@ -103,4 +99,4 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont

#endregion
}
}
}
6 changes: 1 addition & 5 deletions src/NHibernate/InvalidProxyTypeException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -42,11 +42,7 @@ public InvalidProxyTypeException(SerializationInfo info, StreamingContext contex
Errors = (ICollection<string>)info.GetValue("errors", typeof(ICollection));
}

#if NET_4_0
[SecurityCritical]
#else
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand All @@ -55,4 +51,4 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont

#endregion
}
}
}
6 changes: 1 addition & 5 deletions src/NHibernate/NonUniqueObjectException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -79,11 +79,7 @@ protected NonUniqueObjectException(SerializationInfo info, StreamingContext cont
/// <param name="context">
/// The <see cref="StreamingContext"/> that contains contextual information about the source or destination.
/// </param>
#if NET_4_0
[SecurityCritical]
#else
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand All @@ -93,4 +89,4 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont

#endregion
}
}
}
4 changes: 0 additions & 4 deletions src/NHibernate/PropertyAccessException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -99,11 +99,7 @@ protected PropertyAccessException(SerializationInfo info, StreamingContext conte
/// <param name="context">
/// The <see cref="StreamingContext"/> that contains contextual information about the source or destination.
/// </param>
#if NET_4_0
[SecurityCritical]
#else
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand Down
6 changes: 1 addition & 5 deletions src/NHibernate/PropertyValueException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -84,11 +84,7 @@ protected PropertyValueException(SerializationInfo info, StreamingContext contex
/// <param name="context">
/// The <see cref="StreamingContext"/> that contains contextual information about the source or destination.
/// </param>
#if NET_4_0
[SecurityCritical]
#else
[SecurityPermission(SecurityAction.LinkDemand, Flags = SecurityPermissionFlag.SerializationFormatter)]
#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand All @@ -98,4 +94,4 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont

#endregion
}
}
}
6 changes: 1 addition & 5 deletions src/NHibernate/Proxy/DynamicProxy/ProxyObjectReference.cs
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,7 @@ protected ProxyObjectReference(SerializationInfo info, StreamingContext context)

#region IObjectReference Members

#if NET_4_0
[SecurityCritical]
#endif
public object GetRealObject(StreamingContext context)
{
return _proxy;
Expand All @@ -60,11 +58,9 @@ public object GetRealObject(StreamingContext context)

#region ISerializable Members

#if NET_4_0
[SecurityCritical]
#endif
public void GetObjectData(SerializationInfo info, StreamingContext context) {}

#endregion
}
}
}
6 changes: 1 addition & 5 deletions src/NHibernate/QueryException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -113,11 +113,7 @@ protected QueryException(SerializationInfo info, StreamingContext context) : bas
/// <param name="context">
/// The <see cref="StreamingContext"/> that contains contextual information about the source or destination.
/// </param>
#if NET_4_0
[SecurityCritical]
#else
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand All @@ -126,4 +122,4 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont

#endregion
}
}
}
6 changes: 1 addition & 5 deletions src/NHibernate/StaleObjectStateException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -87,11 +87,7 @@ protected StaleObjectStateException(SerializationInfo info, StreamingContext con
/// <param name="context">
/// The <see cref="StreamingContext"/> that contains contextual information about the source or destination.
/// </param>
#if NET_4_0
[SecurityCritical]
#else
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand All @@ -101,4 +97,4 @@ public override void GetObjectData(SerializationInfo info, StreamingContext cont

#endregion
}
}
}
6 changes: 1 addition & 5 deletions src/NHibernate/UnresolvableObjectException.cs
Original file line number Diff line number Diff line change
Expand Up @@ -92,11 +92,7 @@ public static void ThrowIfNull(object o, object id, string entityName)

#region ISerializable Members

#if NET_4_0
[SecurityCritical]
#else
[SecurityPermission(SecurityAction.LinkDemand, Flags=SecurityPermissionFlag.SerializationFormatter)]
#endif
public override void GetObjectData(SerializationInfo info, StreamingContext context)
{
base.GetObjectData(info, context);
Expand All @@ -115,4 +111,4 @@ protected UnresolvableObjectException(SerializationInfo info, StreamingContext c

#endregion
}
}
}
Loading