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

            serviceCollection.AddScoped <IAvatarRepository, AvatarRepo>();
            serviceCollection.AddScoped <IAvatarService, AvatarService>();
            serviceCollection.AddScoped <IPrinter, Printer>();

            var serviceProvider = serviceCollection.BuildServiceProvider();
            var avatarRepo      = serviceProvider.GetRequiredService <IAvatarRepository>();
            var Printer         = serviceProvider.GetRequiredService <IPrinter>();

            new DBInitializer(avatarRepo).InitData;



            IAvatarRepository aRepo = new AvatarRepo();

            DBInitializer db = new DBInitializer(aRepo);

            db.InitData(); // Mock data
            IAvatarService aService = new AvatarService(aRepo);
            IPrinter       print    = new Printer(aService);

            Console.WriteLine("Hello fellow Seven Deadly Sins maniac!");

            Console.WriteLine("Welcome to SDS\nBegin your adventure by choosing an option in the menu");
            print.StartUI();
        }