Ejemplo n.º 1
0
 static void Main(string[] args)
 {
     ZeroApplication.CheckOption();
     ZeroApplication.Discove(typeof(Program).Assembly);
     ZeroApplication.Initialize();
     ZeroApplication.RunAwaite();
 }
Ejemplo n.º 2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            #region standard api
            services.AddOptions();
            services.Configure <HospProxySettings>(Configuration.GetSection(nameof(HospProxySettings)));
            services.AddScoped <ITestService, TestService>();
            //IocHelper.AddScoped<IHospProxyService, HospWebProxyService>();
            //IocHelper.AddScoped<IProxyService, ProxyService>();
            #endregion

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            #region zmq api
            IocHelper.ServiceCollection.Configure <HospProxySettings>(Configuration.GetSection(nameof(HospProxySettings)));
            IocHelper.AddScoped <ITestService, TestService>();
            IocHelper.AddScoped <IHospProxyService, HospWebProxyService>();
            IocHelper.AddScoped <IProxyService, ProxyService>();

            ZeroApplication.Initialize();

            var iar = new AutoRegister();
            iar.Initialize();
            iar.AutoRegist();
            #endregion
        }
Ejemplo n.º 3
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.Configure <CookiePolicyOptions>(options =>
            {
                // This lambda determines whether user consent for non-essential cookies is needed for a given request.
                options.CheckConsentNeeded    = context => true;
                options.MinimumSameSitePolicy = SameSiteMode.None;
            });
            services.AddMvc();
            IocHelper.AddSingleton <PlanManage>();
            ZeroApplication.RegistZeroObject <ApiCounter>();
            ZeroApplication.RegistZeroObject <PlanSubscribe>();
            ZeroApplication.RegistZeroObject <EventSub>();
            ZeroApplication.Initialize();
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            //.AddJsonOptions(options =>
            // {
            //     //忽略循环引用
            //     options.SerializerSettings.ReferenceLoopHandling = ReferenceLoopHandling.Ignore;
            //     //不使用驼峰样式的key
            //     options.SerializerSettings.ContractResolver = new DefaultContractResolver();
            //     //设置时间格式
            //     options.SerializerSettings.DateFormatString = "yyyy-MM-dd";
            // });
        }
Ejemplo n.º 4
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            #region iochelper
            IocHelper.ServiceCollection.Configure <HisOptions>(Configuration.GetSection(nameof(HisOptions)));
            IocHelper.AddScoped <IHisProxyInterface, HisSocketProxy>();
            IocHelper.AddScoped <IHisProxyInterface, HisWebSvcProxy>();
            IocHelper.AddScoped <ProxyFactory>();
            IocHelper.AddScoped <IProxyService, ProxyService>();

            ZeroApplication.Initialize();
            #endregion

            #region standard
            //services.AddOptions();
            //services.Configure<HisOptions>(Configuration.GetSection(nameof(HisOptions)));

            //services.AddScoped<IHisProxyInterface, HisSocketProxy>();
            //services.AddScoped<IHisProxyInterface, HisWebSvcProxy>();
            //services.AddScoped<ProxyFactory>();
            //services.AddScoped<IProxyService, ProxyService>();
            #endregion

            var i = new AutoRegister() as IAutoRegister;
            i.Initialize();
            i.AutoRegist();

            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            //services.AddScoped<IFoo, Foo>();
        }
Ejemplo n.º 5
0
 /// <summary>
 ///     初始化
 /// </summary>
 public static void Initialize()
 {
     ZeroApplication.Initialize();
     RouteOption.CheckOption();
     RouteChahe.InitCache();
     ZeroApplication.ZeroNetEvent += OnZeroNetEvent;
     ZeroApplication.Run();
 }
Ejemplo n.º 6
0
        private static void Main(string[] args)
        {
            Console.WriteLine("Hello ZeroNet");

            ZeroApplication.Initialize();
            ZeroApplication.Discove();
            ZeroApplication.RunAwaite();
        }
Ejemplo n.º 7
0
 static async Task Main(string[] args)
 {
     IocHelper.AddTransient <IMessageConsumer, KafkaConsumer>();
     ZeroApplication.CheckOption();
     ZeroApplication.Discove(typeof(Program).Assembly);
     MessageProducer.Initialize();
     ZeroApplication.Initialize();
     MessageProducer.Publish("test1", "api/test", "{}");
     await ZeroApplication.RunAwaiteAsync();
 }
Ejemplo n.º 8
0
 public App()
 {
     WorkContext.SynchronousContext = new DispatcherSynchronousContext
     {
         Dispatcher = Dispatcher
     };
     Trace.Listeners.Add(new MessageTraceListener());
     ConfigurationManager.BasePath = Path.GetDirectoryName(typeof(App).Assembly.Location);
     ZeroApplication.CheckOption();
     ZeroApplication.Initialize();
 }
Ejemplo n.º 9
0
        /// <summary>
        ///
        /// </summary>
        /// <param name="services"></param>
        /// <remarks>This method gets called by the runtime. Use this method to add services to the container.</remarks>
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            IocHelper.ServiceCollection.Configure <HospProxySettings>(Configuration.GetSection(nameof(HospProxySettings)));
            IocHelper.AddScoped <IHospProxyInterface, HisSocketProxy>();
            IocHelper.AddScoped <IHospProxyInterface, HisWebSvcProxy>();
            IocHelper.AddScoped <HisProxyFactory>();
            IocHelper.AddScoped <IProxyService, ProxyService>();

            ZeroApplication.Initialize();

            IAutoRegister iar = new AutoRegister();

            iar.Initialize();
            iar.AutoRegist();
        }
Ejemplo n.º 10
0
 private static void Main(string[] args)
 {
     ZeroApplication.CheckOption();
     ZeroApplication.Initialize();
     ZeroApplication.RunAwaite();
 }
Ejemplo n.º 11
0
 private static void Main(string[] args)
 {
     ZeroApplication.Initialize();
     ZeroApplication.Discove();
     ZeroApplication.RunAwaite();
 }