Exemplo n.º 1
0
        static void Main(string[] args)
        {
            ServiceCollection services = new ServiceCollection();

            services.AddTransient <IMyInterface1, MyClass1>();
            services.AddTransient <IMyInterface2, MyClass2>();
            services.AddTransient <IMyInterface3, MyClass3>();
            services.AddTransient <IYourInterface, YourClass>();
            ServiceProvider serviceProvider = services.BuildServiceProvider();

            IYourInterface yourInterface = serviceProvider.GetService <IYourInterface>();

            Console.WriteLine("Press any key for continuing...");
            Console.ReadKey();
        }
Exemplo n.º 2
0
 public YourController(IYourInterface client)
 {
     this._client = client;
 }