private static async Task AwakeReceive(string queueName, Type type) { var collection = new ServiceCollection(); collection.AddScoped <ICustomerService, CustomerService>(); collection.AddScoped <ICustomerRepository, CustomerEntityFrameworkRepository>(); var serviceProvider = collection.BuildServiceProvider(); var service = serviceProvider.GetService <ICustomerService>(); var queueSender = new QueueSender(service); await queueSender.Receive(queueName, type); }
private static async Task AwakeReceive(string queueName, Type type) { var collection = new ServiceCollection(); collection.AddScoped <IRentService, RentService>(); collection.AddScoped <IRentItemService, RentItemService>(); collection.AddScoped <IRentRepository, RentEntityFrameworkRepository>(); collection.AddScoped <IRentItemRepository, RentItemEntityFrameworkRepository>(); var serviceProvider = collection.BuildServiceProvider(); var serviceRent = serviceProvider.GetService <IRentService>(); var serviceRentItem = serviceProvider.GetService <IRentItemService>(); var queueSender = new QueueSender(serviceRent, serviceRentItem); await queueSender.Receive(queueName, type); }