Exemplo n.º 1
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().SetCompatibilityVersion(CompatibilityVersion.Version_2_1);

            // 配置
            TORM.Options(options =>
            {
                options.DbConfig.Add("Log", "server=118.24.27.231;database=Log;uid=root;pwd=suncheng1994;");
            });

            TORM.AutoTable <SqlLog>();
            TORM.AutoTable <ExplainErrorLog>();

            // 在消费redis
            Redis.Subscriber();
        }
Exemplo n.º 2
0
        public BaseTest()
        {
            TORM.Options(options =>
            {
                options.Debug = true;              // 调试模式

                var redis        = ConnectionMultiplexer.Connect("118.24.27.231:6379,password=suncheng1994");
                options.RedisLog = redis;              // 使用redis推送sql记录

                redis.ErrorMessage     += Redis_ErrorMessage;
                redis.ConnectionFailed += Redis_ConnectionFailed;

                // 配置数据库连接
                options.DbConfig.Add("Test", "server=118.24.27.231;database=Test;uid=root;pwd=suncheng1994;");
                options.DbConfig.Add("Log", "server=118.24.27.231;database=Log;uid=root;pwd=suncheng1994;");
            });

            //TORM.AutoTable<Rules>();
            //TORM.AutoTable<Schedules>();
            //TORM.AutoTable<Province>();
            //TORM.AutoTable<City>();
            //TORM.AutoTable<Town>();
        }