public bool Validate <T>(Patch patch) { var typeInfo = _typeTreeCache.GetOrCreate <T>(); PropertyAccessor propertyChain; if (!typeInfo.Accessors.TryGetValue(patch.Path, out propertyChain)) { return(false); } return(ValidateDataType(propertyChain.PropertyChain.Last().PropertyType, patch.Value)); }
public ObjectBuilder(TypeTreeCache typeTreeCache, IDictionary <Type, IValueType> valueTypes) { if (typeTreeCache == null) { throw new ArgumentNullException("typeTreeCache"); } if (valueTypes == null) { throw new ArgumentNullException("valueTypes"); } _typeInfo = typeTreeCache.GetOrCreate <T>(); _typeTreeCache = typeTreeCache; _valueTypes = valueTypes; }
private object CreateInstance(Type type) { return(_typeTreeCache.GetOrCreate(type).CreateInstance()); }