Пример #1
0
        public static IServiceCollection AddSqLiteStorageInfrastructure(this IServiceCollection serviceCollection, Action <SqLiteConfiguration> configure)
        {
            var config = new SqLiteConfiguration();

            configure(config);

            return(serviceCollection.AddSqLiteStorageInfrastructure(config));
        }
Пример #2
0
        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));
        }
Пример #3
0
 private static IServiceCollection AddSqLiteStorageInfrastructure(this IServiceCollection serviceCollection, SqLiteConfiguration config)
 {
     return(serviceCollection.AddSingleton <IStorageInfrastructure>(r =>
                                                                    new Storage(CreateSqLiteConnection(config))));
 }