Exemple #1
0
        public virtual bool IsAssignment(ICbValue obj, bool isCast)
        {
            if (obj is ParamNameOnly)
            {
                return(false);
            }

            if (IsList)
            {
                ICbList cbList = GetListValue;

                if (isCast && cbList.IsArrayType && obj.IsList)
                {
                    return(true);    // ToArrya() を行う特殊なキャスト
                }
                if (isCast && obj.IsList)
                {
                    ICbList ListObj = obj.GetListValue;
                    if (ListObj.IsArrayType)
                    {
                        return(true);    // List<>(array) を行う特殊なキャスト
                    }
                }

                if (OriginalType.IsAssignableFrom(obj.OriginalType))
                {
                    return(true);
                }
            }
            return(CbSTUtils.IsAssignment(OriginalType, obj.OriginalType, isCast));
        }
        internal object GenerateInstance(Type type)
        {
            if (type != OriginalType && !OriginalType.IsAssignableFrom(type))
            {
                throw new Exception(string.Format("Provided type does not match or inherit from '{0}'", OriginalType.FullName));
            }

            var options = new ProxyGenerationOptions(new CryptInjectHook());

            options.AddMixinInstance(Activator.CreateInstance(MixinType));
            return(Generator.CreateClassProxy(OriginalType, options, new EncryptedDataStorageInterceptor()));
        }