예제 #1
0
        public static void CreateRepositoriesTest(NpgsqlConnection conn)
        {
            var serviceCollection = new ServiceCollection();

            DatabaseServices.AddServicePostgre(serviceCollection, conn);

            _vendaCervejaRepository = serviceCollection.BuildServiceProvider()
                                      .GetService <IVendaCervejaRepository>();
        }
예제 #2
0
        private static IVendaCervejaRepository ConfigureDatabaseService()
        {
            Console.WriteLine("Inicializando a aplicação...");

            var conn = DatabaseServices.OpenConnection();

            var serviceCollection = new ServiceCollection();

            DatabaseServices.AddServicePostgre(serviceCollection, conn);

            return(serviceCollection.BuildServiceProvider()
                   .GetService <IVendaCervejaRepository>());
        }