private static IPlanBuilderPolicy GetPlanBuilderFromContext(IBuilderContext context, Type typeToBuild, string idToBuild) { IPlanBuilderPolicy planBuilder = context.Policies.Get <IPlanBuilderPolicy>(typeToBuild, idToBuild); if (planBuilder == null) { throw new InvalidOperationException("No Plan builder configured"); } return(planBuilder); }
private static IBuildPlan GetPlanFromContext(IBuilderContext context, Type typeToBuild, string idToBuild) { IBuildPlanPolicy planPolicy = GetPlanPolicyFromContext(context, typeToBuild, idToBuild); IBuildPlan plan = planPolicy.Get(typeToBuild); if (plan == null) { IPlanBuilderPolicy builderPolicy = GetPlanBuilderFromContext(context, typeToBuild, idToBuild); plan = builderPolicy.CreatePlan(typeToBuild, idToBuild); planPolicy.Set(typeToBuild, plan); } return(plan); }