我有一个拥有自己的数据库的MVC网站,一切正常。现在我想从不同的MVC站点访问数据库的表。我在Web.config中添加了连接字符串并将其命名为 summary": "Test recu",//recurring event
"creator": {
"email": "xxxx@gmail.com",
"displayName": "xxxxx",
"self": true
},
"organizer": {
"email": "xxxx@gmail.com",
"displayName": "xxxx",
"self": true
},
"start": {
"dateTime": "2015-08-28T09:30:00-07:00",
"timeZone": "America/Los_Angeles"
},
"end": {
"dateTime": "2015-08-28T10:30:00-07:00",
"timeZone": "America/Los_Angeles"
},
"recurrence": [
"RRULE:FREQ=WEEKLY;BYDAY=TH,FR"
summary": "Test recu",//changed instance that is exception
"creator": {
"email": "xxxx@gmail.com",
"displayName": "xxxx",
"self": true
},
"organizer": {
"email": "xxxx@gmail.com",
"displayName": "xxxx",
"self": true
},
"start": {
"dateTime": "2015-09-03T10:00:00-07:00",
"timeZone": "America/Los_Angeles"
},
"end": {
"dateTime": "2015-09-03T11:00:00-07:00",
"timeZone": "America/Los_Angeles"
},
。然后我添加了一个类来访问该表:
OldMvcDB
当我尝试访问此表时,出现错误:
public class OldSiteDB : DbContext
{
public OldSiteDB() : base("name=OldMvcDB") { }
public DbSet<OldTable> OldTables { get; set; }
}
这是因为旧数据库有很多其他表,因此上下文不匹配。
如何在不必复制新网站中的所有项目的情况下访问此一个表格?