Exemple #1
0
        public ConsumerService()
        {
            try
            {
                var coreBuilder = new CoreBuilder();
                coreBuilder.builder.RegisterModule <AutofacModules>();
                coreBuilder.UserRedis(ConfigurationManager.ConnectionStrings["RedisConnectionString"].ConnectionString);

                coreBuilder.OnStarting(builder =>
                {
                    builder.RegisterType <MemoryEventBusService>().As <IMemoryEventBusService>().InstancePerMatchingLifetimeScope();
                    builder.RegisterType <DistributedEventBusService>().As <IDistributedEventBusService>().InstancePerMatchingLifetimeScope();
                });

                //拆分DLL后需要注册,需要注入的DLL
                Assembly[] asm = Utils.GetAllAssembly("MutualClass.*.dll").ToArray();
                coreBuilder.Build(asm);
                CoreBuilderWork.LifetimeScope.Resolve <IDistributedEventBusService>();

                //var _MutualClassRewardQueueService = CoreBuilderWork.LifetimeScope.Resolve<MutualClassRewardQueueService>();
                //_MutualClassRewardQueueService.imq_onReceive_test();
            }
            catch (Exception ex)
            {
                _Logger.Error("Autofac注册异常", ex);
            }
            InitializeComponent();
        }
Exemple #2
0
        public void OnInvoke()
        {
            var coreBuilder = new CoreBuilder();

            coreBuilder.OnStarting(builder =>
            {
                builder.RegisterModule <GrpcModule>();
            });
            coreBuilder.Build();
        }
Exemple #3
0
        static void Main()
        {
            var coreBuilder = new CoreBuilder();

            coreBuilder.OnStarting(builder =>
            {
                builder.RegisterModule <GrpcModule>();
                builder.RegisterModule <AutofacModule>();
            });
            coreBuilder.Build();

            Application.EnableVisualStyles();
            Application.SetCompatibleTextRenderingDefault(false);
            Application.Run(new Form1());
        }