protected void SetMemberValue <T>(MemberInfo memberInfo, T instance) { if (memberInfo is PropertyInfo && BuilderSetup.ShouldIgnoreProperty((PropertyInfo)memberInfo)) { return; } var currentValue = memberInfo.GetFieldOrPropertyValue(instance); if (!currentValue.IsDefaultValue()) { return; } var handler = GetTypeHandler(memberInfo); if (handler == null) { return; } var value = handler.Method.GetParameters().Length == 1 ? handler.DynamicInvoke(memberInfo) : handler.DynamicInvoke(); memberInfo.SetFieldOrPropertyValue(instance, value); }
protected virtual bool ShouldIgnore(MemberInfo memberInfo) { if (memberInfo is PropertyInfo) { if (BuilderSetup.ShouldIgnoreProperty(((PropertyInfo)memberInfo))) { return(true); } } return(false); }