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

            DatabaseServices.AddServicePostgre(serviceCollection, conn);

            _vendaCervejaRepository = serviceCollection.BuildServiceProvider()
                                      .GetService <IVendaCervejaRepository>();
        }
        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>());
        }