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.Runtime.Serialization;
|
||||
|
||||
namespace Orchard.Caching {
|
||||
public class Weak<T> : WeakReference {
|
||||
public Weak(T target)
|
||||
: base(target) {
|
||||
public class Weak<T> {
|
||||
private readonly WeakReference _target;
|
||||
|
||||
public Weak(T target) {
|
||||
_target = new WeakReference(target);
|
||||
}
|
||||
|
||||
public Weak(T target, bool trackResurrection)
|
||||
: base(target, trackResurrection) {
|
||||
public Weak(T target, bool trackResurrection) {
|
||||
_target = new WeakReference(target, trackResurrection);
|
||||
}
|
||||
|
||||
protected Weak(SerializationInfo info, StreamingContext context)
|
||||
: base(info, context) {
|
||||
}
|
||||
|
||||
public new T Target {
|
||||
get { return (T)base.Target; }
|
||||
set { base.Target = value; }
|
||||
public T Target {
|
||||
get { return (T)_target.Target; }
|
||||
set { _target.Target = value; }
|
||||
}
|
||||
}
|
||||
}
|
Reference in New Issue
Block a user