Beispiel #1
0
        protected override object LoadSerializableObject(string typeName, string id, string propName)
        {
            var bytes = _memoAccessor.LoadSerializablePropertyValue(typeName, id, propName);

            using (var stream = new MemoryStream(bytes)) {
                var formatter = new BinaryFormatter();
                //formatter.Binder = new DelegatingSerializationBinder(
                //    (assemName, typeName) => {
                //        typeName = typeName.Replace("PublicKeyToken=null", "PublicKeyToken=89184b2d63ba68a6");
                //        var name = new AssemblyName(assemName);
                //        var assem = default(Assembly);
                //        try {
                //            assem = Assembly.Load(name.Name);
                //        } catch {
                //            assem = Assembly.Load(name);
                //        }
                //        return assem.GetType(typeName);
                //    }
                //);
                return(formatter.Deserialize(stream));
            }
        }