public static T GetRequiredConfiguration <T>(this IServiceBuilder sb) { var o = sb.GetConfiguration <T>(); if (o == null) { throw new BuilderException($"missing configuration {typeof(T).FullName}"); } return((T)o); }
public void Build(IServiceBuilder builder) { var configuration = builder.GetConfiguration <CounterBenchmarkConfiguration>(); builder .BuildService <CounterService>() .BuildService <HarnessService>() .ScanThisDLL() .OverridePlacement(placementBuilder => placementBuilder .PlaceOnSubrange <IGeneratorAffinity>(0, configuration.NumberCounterProcesses) .PlaceOnSubrange <ICounterAffinity>(configuration.NumberGeneratorProcesses, configuration.NumberCounterProcesses) ) ; }
public static bool TryGetConfiguration <T>(this IServiceBuilder sb, out T result) { var o = sb.GetConfiguration <T>(); if (o != null) { result = (T)o; return(true); } else { result = default(T); return(false); } }