mirror of
https://github.com/claunia/marechai.git
synced 2025-12-16 19:14:25 +00:00
Move EF connection string to ASP.NET startup.
This commit is contained in:
@@ -37,15 +37,6 @@ namespace Cicm.Database.Models
|
||||
public virtual DbSet<SoundSynths> SoundSynths { get; set; }
|
||||
public virtual DbSet<StorageByMachine> 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<Admins>(entity =>
|
||||
|
||||
@@ -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<cicmContext>(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.
|
||||
|
||||
Reference in New Issue
Block a user