// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.AddResponseCompression(); services.AddSignalR(); services.AddSingleton(Configuration); DependencyIoC.InjectDataAccess.Init(services); DependencyIoC.InjectBusinessLayer.Init(services); IoCSettings.InitIoC(services); }
static void Main(string[] args) { var services = new ServiceCollection(); IoCSettings.InitIoC(services); var serviceResolver = services.BuildServiceProvider(); UserBus userBus = serviceResolver.GetService <UserBus>(); userBus?.Start(); //Console.Write("Press <Enter> to exit... "); //while (Console.ReadKey().Key != ConsoleKey.Enter) { } }
// This method gets called by the runtime. Use this method to add services to the container. public void ConfigureServices(IServiceCollection services) { services.Configure <IISOptions>(options => { options.ForwardClientCertificate = false; }); services.AddSingleton(Configuration); //first init inner owned instance from .net core IoCSettings.InitIoC(services); //add IoC DB instance DependencyIoC.InjectDataAccess.Init(services); //add IoC BL instance DependencyIoC.InjectBusinessLayer.Init(services); //in memory cache force initialize ? if (Infrastructure.Constants.forceCache) { Infrastructure.CacheManager.ForceInitCache(services); } }
static void Main(string[] args) { var services = new ServiceCollection(); IoCSettings.InitIoC(services); var serviceResolver = services.BuildServiceProvider(); //resolve my publisher wrapper instance IPublishBus publishBus = serviceResolver.GetService <IPublishBus>(); //send a message in the queue BasePublishEvent AddPublishEvent = new BasePublishEvent(new UserDTO() { FirstName = "Publish2", LastName = "Event2" }, "User/Add"); publishBus.Publish(AddPublishEvent); //Console.Write("Press <Enter> to exit... "); //while (Console.ReadKey().Key != ConsoleKey.Enter) { } }