Example #1
0
        private static bool ShouldUseLocalVariable(IQualifiedMemberContext context)
        {
            if (context.TargetMember.IsSimple &&
                !context.TargetType.GetNonNullableType().IsEnum())
            {
                return(false);
            }

            if (context.UseSingleMappingExpression())
            {
                return(false);
            }

            if (context.TargetMember.IsComplex &&
                (context.TargetMember.IsReadOnly || context.TargetIsDefinitelyPopulated()) &&
                !context.TargetMemberIsUserStruct())
            {
                return(false);
            }

            return(true);
        }
 public static bool TargetIsDefinitelyPopulated(this IQualifiedMemberContext context)
 {
     return(context.RuleSet.Settings.RootHasPopulatedTarget &&
            (context.IsRoot || context.TargetMemberIsUserStruct()));
 }