public void CreatePlan(ServiceGraph services) { if (HasPlanned) { return; } try { services.StartingToPlan(this); } catch (Exception e) { ErrorMessages.Add(e.Message); services.FinishedPlanning(); HasPlanned = true; return; } // Can't do the planning on open generic types 'cause bad stuff happens if (!ServiceType.IsOpenGeneric()) { foreach (var policy in services.InstancePolicies) { policy.Apply(this); } var atts = ImplementationType.GetAllAttributes <LamarAttribute>(); foreach (var att in atts) { att.Alter(this); if (this is IConfiguredInstance) { att.Alter(this.As <IConfiguredInstance>()); } } var dependencies = createPlan(services) ?? Enumerable.Empty <Instance>(); Dependencies = dependencies.Concat(dependencies.SelectMany(x => x.Dependencies)).Distinct().ToArray(); } services.ClearPlanning(); HasPlanned = true; }