Exemple #1
0
        protected override void OnModelCreating(ModelBuilder modelBuilder)
        {
            var mappings = MappingsHelper.GetMappings();

            foreach (var mapping in mappings)
            {
                mapping.Visit(modelBuilder);
            }
        }
Exemple #2
0
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddMvc();
            services.AddCors();


            MappingsHelper.Configure();

            services.AddTransient <IMongoRepository, Repository>();
            services.AddTransient <IMongoContext, MongoContext>();
        }
Exemple #3
0
        private void comboBox1_SelectedIndexChanged(object sender, EventArgs e)
        {
            var currentFileSelected = fileComboBox.Text;

            if (currentFileSelected == "")
            {
                return;
            }

            var lines = System.IO.File.ReadAllLines(currentFileSelected);

            helper = new MappingsHelper(lines);

            codeTextBox.Text = System.IO.File.ReadAllText(currentFileSelected);
            Display(currentFileSelected);
        }
        // This method gets called by the runtime. Use this method to add services to the container.
        public void ConfigureServices(IServiceCollection services)
        {
            services.AddAuthentication(JwtBearerDefaults.AuthenticationScheme)
            .AddJwtBearer(options =>
            {
                options.RequireHttpsMetadata      = false;
                options.TokenValidationParameters = new TokenValidationParameters
                {
                    // укзывает, будет ли валидироваться издатель при валидации токена
                    ValidateIssuer = true,
                    // строка, представляющая издателя
                    ValidIssuer = Constants.ISSUER,

                    // будет ли валидироваться потребитель токена
                    ValidateAudience = true,
                    // установка потребителя токена
                    ValidAudience = Constants.AUDIENCE,
                    // будет ли валидироваться время существования
                    ValidateLifetime = true,

                    // установка ключа безопасности
                    IssuerSigningKey = Constants.GetSymmetricSecurityKey(),
                    // валидация ключа безопасности
                    ValidateIssuerSigningKey = true,
                    ClockSkew = TimeSpan.Zero
                };
            });

            services.AddMvc();

            var corsBuilder = new CorsPolicyBuilder();

            corsBuilder.AllowAnyHeader();
            corsBuilder.AllowAnyMethod();
            corsBuilder.AllowAnyOrigin(); // For anyone access.
            //corsBuilder.WithOrigins("http://localhost:56573"); // for a specific url. Don't add a forward slash on the end!
            corsBuilder.AllowCredentials();

            services.AddCors(options =>
            {
                options.AddPolicy("SiteCorsPolicy", corsBuilder.Build());
            });

            MappingsHelper.Configure();

            RegisterTypes(services);
        }
Exemple #5
0
        private void BuildButton_Click(object sender, EventArgs e)
        {
            MMIO.Clear();

            for (int i = 0; i < Controls.Count; i++)
            {
                if (Controls[i].Tag as string == "RemoveMe")
                {
                    Controls.RemoveAt(i);
                    break;
                }
            }

            fileComboBox.SelectedIndex = -1;

            System.IO.File.WriteAllText("temp.txt", codeTextBox.Text);

            helper = new MappingsHelper(System.IO.File.ReadAllLines("temp.txt"));

            Display("temp.txt");
        }