static void Main(string[] args) { ZeroApplication.CheckOption(); ZeroApplication.Discove(typeof(Program).Assembly); ZeroApplication.Initialize(); ZeroApplication.RunAwaite(); }
// 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 }
// 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"; // }); }
// 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>(); }
/// <summary> /// 初始化 /// </summary> public static void Initialize() { ZeroApplication.Initialize(); RouteOption.CheckOption(); RouteChahe.InitCache(); ZeroApplication.ZeroNetEvent += OnZeroNetEvent; ZeroApplication.Run(); }
private static void Main(string[] args) { Console.WriteLine("Hello ZeroNet"); ZeroApplication.Initialize(); ZeroApplication.Discove(); ZeroApplication.RunAwaite(); }
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(); }
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(); }
/// <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(); }
private static void Main(string[] args) { ZeroApplication.CheckOption(); ZeroApplication.Initialize(); ZeroApplication.RunAwaite(); }
private static void Main(string[] args) { ZeroApplication.Initialize(); ZeroApplication.Discove(); ZeroApplication.RunAwaite(); }