示例#1
0
        public static void PatchObject(T entity, ManahostPatcherModel[] operations)
        {
            ManahostEntityCaching instance = ManahostEntityCaching.Instance;
            Type entityType = typeof(T);

            foreach (ManahostPatcherModel operation in operations)
            {
                PatchField(entity, instance, entityType, operation.Field, operation.Value);
            }
        }
示例#2
0
        private static void PatchField(T entity, ManahostEntityCaching instance, Type entityType, String field, Object value)
        {
            PropertyInfo pInfoFromField = instance.RetrievePropertyInfoFromFieldName(entityType, field);

            if (pInfoFromField == null || Attribute.IsDefined(pInfoFromField, typeof(NotMappedAttribute)) ||
                Attribute.IsDefined(pInfoFromField, typeof(IgnoreDataMemberAttribute)) ||
                sforbiddenReplacement.Contains(field))
            {
                return;
            }
            pInfoFromField.SetValue(entity, value);
        }