를 사용하는 DbConnection 또는 연결 문자열 중 하나를 지정하지 않고 구성되었습니다?관계형 상점은 내가 asp.net의 vnext 및 ef7를 사용하여
내 응용 프로그램을 시작 고려해
using DomainModels;
using Microsoft.AspNet.Builder;
using Microsoft.AspNet.Hosting;
using Microsoft.AspNet.Routing;
using Microsoft.Framework.ConfigurationModel;
using Microsoft.Framework.DependencyInjection;
using Presentation.DataAccessLayer.Context;
using Microsoft.AspNet.Identity;
namespace Presentation
{
public class Startup
{
public Startup(IHostingEnvironment env)
{
Configuration = new Configuration()
.AddJsonFile("config.json")
.AddEnvironmentVariables();
}
public IConfiguration Configuration { get; set; }
public void ConfigureServices(IServiceCollection services)
{
services.AddEntityFramework().AddSqlServer().AddDbContext<ApplicationContext>();
services.AddDefaultIdentity<ApplicationContext, ApplicationUser, IdentityRole>(Configuration);
services.AddMvc();
}
public void Configure(IApplicationBuilder app)
{
app.UseStaticFiles();
app.UseIdentity();
app.UseMvc(
routes =>
{
routes.MapRoute("default", "{controller}/{action}/{id?}",
new {controller = "Home", action = "Index"});
});
}
}
}
을이 내 config.json입니다 :
protected override void OnConfiguring(DbContextOptions options)
{
options.UseSqlServer(Startup.Configuration.Get("Data:DefaultConnection:ConnectionString"));
}
이것은 있습니다. 순수한 천재, 나는 심지어 컨텍스트와 일치하는 이름을 알아 차리지 못했고, 다른 dll로 컨텍스트를 옮기고 이름을 변경했기 때문에 이것은 누락 된 링크였습니다. 고맙습니다. – Vassi