public static IServiceCollection AddSqLiteStorageInfrastructure(this IServiceCollection serviceCollection, Action <SqLiteConfiguration> configure) { var config = new SqLiteConfiguration(); configure(config); return(serviceCollection.AddSqLiteStorageInfrastructure(config)); }
private static SQLiteConnection CreateSqLiteConnection(SqLiteConfiguration config) { if (string.IsNullOrEmpty(config.ConnectionString)) { throw new ArgumentException("The connection string can't be null", nameof(config)); } return(new SQLiteConnection(config.ConnectionString)); }
private static IServiceCollection AddSqLiteStorageInfrastructure(this IServiceCollection serviceCollection, SqLiteConfiguration config) { return(serviceCollection.AddSingleton <IStorageInfrastructure>(r => new Storage(CreateSqLiteConnection(config)))); }