/// <summary>
        /// Convert to ObjectContext <br />
        /// 转换为可验证对象上下文 <see cref="VerifiableObjectContext"/>
        /// </summary>
        /// <returns></returns>
        public VerifiableObjectContext ConvertToObjectContext()
        {
            if (MemberType.IsBasicType())
            {
                return(_parentContext);
            }

            var contract = VerifiableObjectContractManager.Resolve(MemberType);

            return(new VerifiableObjectContext(Value, contract, _parentContext));
        }
예제 #2
0
        public VerifiableObjectContext Resolve(Type declaringType, object instance, string instanceName)
        {
            if (instance is VerifiableObjectContext objectContext)
            {
                return(objectContext);
            }
            if (instance is VerifiableMemberContext memberContext)
            {
                return(memberContext.ConvertToObjectContext());
            }

            var contract = VerifiableObjectContractManager.Resolve(declaringType);

            return(new VerifiableObjectContext(instance, contract, instanceName));
        }
예제 #3
0
        public VerifiableObjectContext Resolve <T>(T instance)
        {
            if (instance is VerifiableObjectContext objectContext)
            {
                return(objectContext);
            }
            if (instance is VerifiableMemberContext memberContext)
            {
                return(memberContext.ConvertToObjectContext());
            }

            var contract = VerifiableObjectContractManager.Resolve <T>();

            return(new VerifiableObjectContext(instance, contract));
        }
예제 #4
0
        public VerifiableObjectContext Resolve(Type declaringType, IDictionary <string, object> keyValueCollection, string instanceName)
        {
            var contract = VerifiableObjectContractManager.Resolve(declaringType);

            return(new VerifiableObjectContext(keyValueCollection, contract, instanceName));
        }
예제 #5
0
        public VerifiableObjectContext Resolve <T>(IDictionary <string, object> keyValueCollection)
        {
            var contract = VerifiableObjectContractManager.Resolve <T>();

            return(new VerifiableObjectContext(keyValueCollection, contract));
        }