Ejemplo n.º 1
0
        static void Main(string[] args)
        {
            BsonSerializer.RegisterSerializer(typeof(DateTime), new DateTimeSerializer(DateTimeKind.Local, BsonType.DateTime));

            var serviceCollection = new ServiceCollection();

            StartupConfiguration.ConfigureServices(serviceCollection);
            StartupHandle.ConfigureServices(serviceCollection);

            try
            {
                var command = args[0];
                if (string.IsNullOrEmpty(command))
                {
                    return;
                }

                logger.Debug($"Program runing start args[0]:{command}");

                var handle = serviceCollection.BuildServiceProvider().GetServices <IHandle>().Where(item => item.Command == command).FirstOrDefault();
                handle.Execution(args);

                logger.Debug("Program runing completed...");
            }
            catch (Exception exception)
            {
                logger.Error(exception);
                throw exception;
            }
        }
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)
        {
            StartupConfiguration.ConfigureServices(services);

            services.AddControllersWithViews();
            services.AddRazorPages()
            .AddRazorRuntimeCompilation();
        }