示例#1
0
        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));
        }
示例#2
0
 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;
 }
示例#3
0
 private object CreateInstance(Type type)
 {
     return(_typeTreeCache.GetOrCreate(type).CreateInstance());
 }