You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
it would be nice if conditions are evaluated before ResolveValue is called in order to avoid executing code (i.e. calling the getter of the underlying property) which won't be needed anyway because a condition will return false.
Specifing IMemberConfigurationExpression.Ignore() would work since this is evaluated before resolving the value but my use case depends on dynamic variables.
All conditions are evaluated in line 133, but the source value is resolved in line 104.
try
{
result = propertyMap.ResolveValue(context);
}
// snip...
if (!propertyMap.ShouldAssignValue(newContext))
return;
Use Case where this is helpful:
If you have an application with EntityFramework and have implemented a property based security layer which may or may not map a certain property based on privileges you can use the op.Condition () method to define these rules. But currently AutoMapper invokes the getter and therefore triggers an SELECT which may not be needed since the condition returns false anyway.
The text was updated successfully, but these errors were encountered:
What I wound up doing is creating overloads for PreConditions. Instead of Condition, use PreCondition. There were a lot of folks that wanted the current conditions where they are (as shown by the failing tests I got), so this way you can use preconditions when you don't want the source/destination value resolved before checking the condition.
Hi,
it would be nice if conditions are evaluated before ResolveValue is called in order to avoid executing code (i.e. calling the getter of the underlying property) which won't be needed anyway because a condition will return false.
Specifing IMemberConfigurationExpression.Ignore() would work since this is evaluated before resolving the value but my use case depends on dynamic variables.
Source:
All conditions are evaluated in line 133, but the source value is resolved in line 104.
Use Case where this is helpful:
If you have an application with EntityFramework and have implemented a property based security layer which may or may not map a certain property based on privileges you can use the op.Condition () method to define these rules. But currently AutoMapper invokes the getter and therefore triggers an SELECT which may not be needed since the condition returns false anyway.
The text was updated successfully, but these errors were encountered: