업데이트 : 내 POCO 개체에 숨겨져있는 추상 형식의 속성이있는 것으로 나타났습니다. 이 속성을 제거하면 문제가 해결됩니다.DbContext가 모델 우선 데이터베이스를 초기화하지 못했습니다.
내 데이터베이스를 생성 4 CTP 5 엔티티 프레임 워크 모델 - 첫 번째 시나리오를하기 위해 노력하고있어 (현재 SQL 서버 CE4 백엔드를 사용하여,하지만 난은 SQL 서버 2008 백엔드에 재현 할 수있는) 내 모델 .
어떻게 든 내 모델 정의를 엉망으로 만들었지 만 오류 메시지가 나를 현명하게 남겨 두지 못하는 것 같아 보입니다.
내 DbContext 개체는 같은 설정 :
public class MyDb : DbContext
{
public MyDb()
{
// Apply forced recreation tactics for now
DbDatabase.SetInitializer<MyDb>(new CreateDatabaseIfNotExists<MyDb>());
}
public DbSet<UserAccount> UserAccounts { get; set; }
public DbSet<OtherData> OtherDatas { get; set; }
// etc
}
(다음과 같이) 나는 그것을 쿼리 할 때 :
MyDb db = new MyDb();
var matchingAccount = from user in db.UserAccounts where user.Email == email select user;
return matchingAccount.SingleOrDefault();
내가받을 다음과 같은 오류 : 그러나
[ArgumentNullException: Value cannot be null. Parameter name: entitySet]
System.Lazy1.get_Value() +9591079
1.Initialize() +62 System.Data.Entity.Internal.Linq.InternalSet
System.Data.Entity.Internal.LazyInternalContext.InitializeContext() +371 System.Data.Entity.Internal.InternalContext.Initialize() +16 System.Data.Entity.Internal.InternalContext.GetEntitySetAndBaseTypeForType(Type entityType) +15
System.Data.Entity.Internal.Linq.InternalSet1.get_Provider() +15 System.Data.Entity.Infrastructure.DbQuery
1.System.Linq.IQueryable.get_Provider() +13 System.Linq.Queryable.Where(IQueryable1 source, Expression
1 predicate) +63
처음 빌드 할 때 이것은 특정 오류입니다 :
[ArgumentNullException: Value cannot be null. Parameter name: entitySet]
System.Data.Entity.ModelConfiguration.Utilities.RuntimeFailureMethods.ReportFailure(ContractFailureKind contractFailureKind, String userMessage, String conditionText, Exception innerException) +970860
System.Data.Entity.ModelConfiguration.Edm.Db.Mapping.DbDatabaseMappingExtensions.GetEntitySetMapping(DbDatabaseMapping databaseMapping, EdmEntitySet entitySet) +147
System.Data.Entity.ModelConfiguration.Edm.Services.EntityTypeMappingGenerator.Generate(EdmEntityType entityType, DbDatabaseMapping databaseMapping) +206
System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.GenerateEntityTypes(EdmModel model, DbDatabaseMapping databaseMapping) +253
System.Data.Entity.ModelConfiguration.Edm.Services.DatabaseMappingGenerator.Generate(EdmModel model) +168
System.Data.Entity.ModelConfiguration.Edm.EdmModelExtensions.GenerateDatabaseMapping(EdmModel model, DbProviderManifest providerManifest) +233
System.Data.Entity.ModelConfiguration.ModelBuilder.Build(DbProviderManifest providerManifest, DbProviderInfo providerInfo, Boolean validateModel) +280 System.Data.Entity.ModelConfiguration.ModelBuilder.Build(DbConnection providerConnection) +173
System.Data.Entity.Internal.LazyInternalContext.CreateModel() +61
정말 고마워요! 나는 왜 내 DB가 작동을 멈추게되었는지 궁금해했다. 어제는 내 도메인 객체 중 하나에 속성으로 추상 클래스를 추가했습니다. 위로 나는 생각한다! – nialljsmith