public DiagnosticResult[] Analyze(IEnumerable <InstanceProducer> producers) => ( from producer in producers from relationship in producer.GetRelationships() where relationship.Dependency.Registration.ShouldNotBeSuppressed(this.DiagnosticType) let container = producer.Registration.Container where LifestyleMismatchChecker.HasLifestyleMismatch(container, relationship) select new LifestyleMismatchDiagnosticResult( serviceType : producer.ServiceType, description : BuildRelationshipDescription(relationship), relationship : relationship)) .ToArray();
private static bool HasPossibleLifestyleMismatch(KnownRelationship dependency) => LifestyleMismatchChecker.HasLifestyleMismatch(new Container(), dependency);
private static bool HasPossibleLifestyleMismatch( KnownRelationship dependency, bool?useLoosenedLifestyleMismatchBehavior = null) => LifestyleMismatchChecker.HasLifestyleMismatch( CreateContainer(useLoosenedLifestyleMismatchBehavior), dependency);