public Store(Action <IStoreOption> optionAction) { Option = new StoreOption(); optionAction?.Invoke(Option); AfterOptionAssigned(); }
public static IServiceCollection AddDataAccess(this IServiceCollection services, Action <IStoreOption> optionAction) { if (optionAction == null) { throw new ArgumentNullException(nameof(optionAction)); } var option = new StoreOption(); optionAction.Invoke(option); services.AddSingleton <IStore>(new Store(option)); return(services); }