Example #1
0
        static void Main(string[] args)
        {
            var serviceCollection = new ServiceCollection();

            serviceCollection.AddScoped <IPetRepository, PetRepository>();
            serviceCollection.AddScoped <IPetService, PetService>();
            serviceCollection.AddScoped <IPrinter, Printer>();

            var serviceProvider = serviceCollection.BuildServiceProvider();
            var printer         = serviceProvider.GetRequiredService <IPrinter>();

            printer.startUI();
            FakeDb.InitialisePetData();
        }