public override void BindToName(Type serializedType, out string assemblyName, out string typeName)
 {
     //var longAssemblyName = serializedType.Assembly.FullName;
     if (TypeCacheUtils.IsGeneratedType(serializedType))
     {
         serializedType = serializedType.BaseType;
     }
     TypeCacheUtils.AssemblyQualifiedNameCache(serializedType, out assemblyName, out typeName);
 }
        public object ObjectToRaw(object obj)
        {
            var builderObjectToRaw = new StringBuilder(500);

            using (var writerObjectToRaw = new StringWriter(builderObjectToRaw))
            {
                var type = obj.GetType();
                //No longer necessary TypeCacheUtils typeMarks make the mark of the
                //UnIntercepted and InterceptedTypes equal
                //if (TypeCacheUtils.IsGeneratedType(type))
                //{
                //    TypeCacheUtils.GetOriginalType(ref type);
                //}
                //builderObjectToRaw.Clear();
                string typeMark = null;
                if (TypeCacheUtils.ISSAFETOSHORTENALLTYPES && TypeCacheUtils.SHORTENTYPENAME)
                {
                    typeMark = TypeCacheUtils.AssemblyQualifiedNameCache(type);
                }
#pragma warning disable 0162
                else
                {
                    typeMark = TypeCacheUtils.AssemblyQualifiedNameCache(type);
                }
#pragma warning restore 0162
                builderObjectToRaw.Append(typeMark);
                var depentdsC = obj as IDependentsContainer;
                if (depentdsC != null && depentdsC.Dependents != null)
                {
                    builderObjectToRaw.Append(string.Join(",", depentdsC.Dependents));
                }
                builderObjectToRaw.Append("?");
                using (JsonTextWriter jw = new JsonTextWriter(writerObjectToRaw))
                {
                    jw.ArrayPool = JsonArrayPool.Instance;
                    sessionStorageSerializer.Serialize(writerObjectToRaw, obj, type);
                }
            }
            return(builderObjectToRaw.ToString());
        }
            private void WriteKeyType(object val)
            {
                var typeVal = (Type)val;

                writer.WritePropertyName(TypeCacheUtils.AssemblyQualifiedNameCache(typeVal));
            }