启用迁移说在程序集“ScheduleWeb”中找到了多个上下文类型 [英] Enable Migrations says More than one context type was found in the assembly 'ScheduleWeb'

查看:358
本文介绍了启用迁移说在程序集“ScheduleWeb”中找到了多个上下文类型的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

您好,我正在尝试为我的计划应用程序启用迁移。我是新手,当我在控制台中键入启用迁移时,我不断收到此消息



在程序集ScheduleWeb中找到了多个上下文类型。 br />


要启用ScheduleWeb.Models.ApplicationDbContext的迁移,请使用Enable-Migrations -ContextTypeName ScheduleWeb.Models.ApplicationDbContext。



要启用ScheduleWeb.Models.ScheduleDbContext的迁移,请使用Enable-Migrations -ContextTypeName ScheduleWeb.Models.ScheduleDbContext。



创建两个迁移将创建两个数据库。但我希望我的用户数据与我的应用程序数据一致。我怎样才能实现这个

Hello, i am trying to enable migrations for my scheduling application. I am new to this and i keep getting this message when i type enable migrations in the console

More than one context type was found in the assembly 'ScheduleWeb'.

To enable migrations for 'ScheduleWeb.Models.ApplicationDbContext', use Enable-Migrations -ContextTypeName ScheduleWeb.Models.ApplicationDbContext.

To enable migrations for 'ScheduleWeb.Models.ScheduleDbContext', use Enable-Migrations -ContextTypeName ScheduleWeb.Models.ScheduleDbContext.

Creating two migrations will create two databases. But i want my userdata along side my application data. how can i achieve this

推荐答案

你的类应该是一个上下文中的DBSets。您似乎已将它们拆分为2个上下文。
Your classes should be DBSets in the one context. It appears that you have split them into 2 contexts.


这篇关于启用迁移说在程序集“ScheduleWeb”中找到了多个上下文类型的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆