public MemberInvocationInstanceCountConfiguration GetMaxInvocationInstanceCountConfigurationForMember( string simpleMemberName) { var maxRecursionDepthConfig = MemberInvocationInstanceCountConfigurations .Where(config => simpleMemberName.StartsWith(config.MemberNamePrefix)) .OrderByDescending(config => config.MemberNamePrefix.Length) .FirstOrDefault(); if (maxRecursionDepthConfig != null) { return(maxRecursionDepthConfig); } // Adding the configuration so if the object is modified it's saved in the TransformerConfiguration. var newConfiguration = new MemberInvocationInstanceCountConfiguration(simpleMemberName); AddMemberInvocationInstanceCountConfiguration(newConfiguration); return(newConfiguration); }
public void AddMemberInvocationInstanceCountConfiguration(MemberInvocationInstanceCountConfiguration configuration) { _memberInvocationInstanceCountConfigurations .AddOrUpdate(configuration.MemberNamePrefix, configuration, (key, previousConfiguration) => configuration); }