diff --git a/Cicm.Database/Models/cicmContext.cs b/Cicm.Database/Models/cicmContext.cs index d96b5a38..db46658f 100644 --- a/Cicm.Database/Models/cicmContext.cs +++ b/Cicm.Database/Models/cicmContext.cs @@ -37,15 +37,6 @@ namespace Cicm.Database.Models public virtual DbSet SoundSynths { get; set; } public virtual DbSet StorageByMachine { get; set; } - protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder) - { - if(!optionsBuilder.IsConfigured) - { - #warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings. - optionsBuilder.UseMySql("server=localhost;port=3306;user=cicm;password=cicmpass;database=cicm"); - } - } - protected override void OnModelCreating(ModelBuilder modelBuilder) { modelBuilder.Entity(entity => diff --git a/cicm_web/Startup.cs b/cicm_web/Startup.cs index 65e58590..8f595f3e 100644 --- a/cicm_web/Startup.cs +++ b/cicm_web/Startup.cs @@ -28,8 +28,10 @@ // Copyright © 2003-2018 Natalia Portillo *******************************************************************************/ +using Cicm.Database.Models; using Microsoft.AspNetCore.Builder; using Microsoft.AspNetCore.Hosting; +using Microsoft.EntityFrameworkCore; using Microsoft.Extensions.Configuration; using Microsoft.Extensions.DependencyInjection; @@ -49,6 +51,11 @@ namespace cicm_web public void ConfigureServices(IServiceCollection services) { services.AddMvc(); + + #warning To protect potentially sensitive information in your connection string, you should move it out of source code. See http://go.microsoft.com/fwlink/?LinkId=723263 for guidance on storing connection strings. + services.AddDbContext(options => + options + .UseMySql("server=localhost;port=3306;user=cicm;password=cicmpass;database=cicm")); } // This method gets called by the runtime. Use this method to configure the HTTP request pipeline.