mirror of
https://github.com/OrchardCMS/Orchard.git
synced 2025-10-14 19:04:51 +08:00
Medium Trust: Update Weak class to not extend WeakReference and avoid demaning inheritancedemand security permission.
--HG-- branch : dev
This commit is contained in:
@@ -1,23 +1,20 @@
|
|||||||
using System;
|
using System;
|
||||||
using System.Runtime.Serialization;
|
|
||||||
|
|
||||||
namespace Orchard.Caching {
|
namespace Orchard.Caching {
|
||||||
public class Weak<T> : WeakReference {
|
public class Weak<T> {
|
||||||
public Weak(T target)
|
private readonly WeakReference _target;
|
||||||
: base(target) {
|
|
||||||
|
public Weak(T target) {
|
||||||
|
_target = new WeakReference(target);
|
||||||
}
|
}
|
||||||
|
|
||||||
public Weak(T target, bool trackResurrection)
|
public Weak(T target, bool trackResurrection) {
|
||||||
: base(target, trackResurrection) {
|
_target = new WeakReference(target, trackResurrection);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected Weak(SerializationInfo info, StreamingContext context)
|
public T Target {
|
||||||
: base(info, context) {
|
get { return (T)_target.Target; }
|
||||||
}
|
set { _target.Target = value; }
|
||||||
|
|
||||||
public new T Target {
|
|
||||||
get { return (T)base.Target; }
|
|
||||||
set { base.Target = value; }
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
Reference in New Issue
Block a user