private Type DemandSourceContextDeep(Type sourceType) { if (SourceContexts.Length == 0) { throw new DittoConfigurationException( "Sources have not been setup for '{0}'. Did you forget to call 'From'?", DestinationType); } if (SourceContexts.Any(its => its.SourceType == sourceType)) //this gives a little perf boost { return(sourceType); } Type discovered; if (source2AlternateTypes.TryGetValue(sourceType, out discovered)) { return(discovered); } var deepThots = new SourceContextDiscovery(sourceType); var context = SourceContexts.FirstOrDefault(deepThots.IsSatisfiedBy); if (context != null) { source2AlternateTypes[sourceType] = deepThots.TypeToUse; return(deepThots.TypeToUse); } throw new DittoConfigurationException("'{0}' has not been setup as a source for '{1}'.", sourceType, DestinationType); }
private Type DemandSourceContextDeep(Type sourceType) { if (SourceContexts.Length == 0) throw new DittoConfigurationException( "Sources have not been setup for '{0}'. Did you forget to call 'From'?", DestinationType); if (SourceContexts.Any(its => its.SourceType == sourceType)) //this gives a little perf boost return sourceType; Type discovered; if (source2AlternateTypes.TryGetValue(sourceType, out discovered)) return discovered; var deepThots = new SourceContextDiscovery(sourceType); var context = SourceContexts.FirstOrDefault(deepThots.IsSatisfiedBy); if(context!=null) { source2AlternateTypes[sourceType] = deepThots.TypeToUse; return deepThots.TypeToUse; } throw new DittoConfigurationException("'{0}' has not been setup as a source for '{1}'.", sourceType, DestinationType); }