/// <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)); }
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)); }
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)); }
public VerifiableObjectContext Resolve(Type declaringType, IDictionary <string, object> keyValueCollection, string instanceName) { var contract = VerifiableObjectContractManager.Resolve(declaringType); return(new VerifiableObjectContext(keyValueCollection, contract, instanceName)); }
public VerifiableObjectContext Resolve <T>(IDictionary <string, object> keyValueCollection) { var contract = VerifiableObjectContractManager.Resolve <T>(); return(new VerifiableObjectContext(keyValueCollection, contract)); }