1

私はこのコードファーストのパターンにまったく慣れていません。クラスを作成したので、データベースにテーブルを作成したいと考えています。PM コンソールで、「add migration addSummaries」と書いて Enter キーを押しました。そして、私は次のエラーがあります:

PM> add-migration addsummaries
System.ArgumentNullException: Value cannot be null.
Parameter name: key
at System.Collections.Generic.Dictionary`2.FindEntry(TKey key)
at System.Collections.Generic.Dictionary`2.TryGetValue(TKey key, TValue& value)
at System.Data.Entity.ModelConfiguration.Configuration.Mapping.SortedEntityTypeIndex.Add(EdmEn    titySet entitySet, EdmEntityType entityType)
at  System.Data.Entity.ModelConfiguration.Configuration.Mapping.EntityMappingService.Analyze()
at  System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.ConfigureEntityTypes (DbDatabaseMapping databaseMapping, DbProviderManifest providerManifest)
at     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration.Configure(DbDatabase Mapping databaseMapping, DbProviderManifest providerManifest)
at System.Data.Entity.DbModelBuilder.Build(DbProviderManifest providerManifest,  DbProviderInfo providerInfo)
at System.Data.Entity.DbModelBuilder.Build(DbConnection providerConnection)
at System.Data.Entity.Internal.LazyInternalContext.CreateModel(LazyInternalContext  internalContext)
at System.Data.Entity.Internal.RetryLazy`2.GetValue(TInput input)
at System.Data.Entity.Internal.LazyInternalContext.InitializeContext()
at System.Data.Entity.Internal.LazyInternalContext.get_CodeFirstModel()
at System.Data.Entity.Infrastructure.EdmxWriter.WriteEdmx(DbContext context, XmlWriter  writer)
at System.Data.Entity.Migrations.Extensions.DbContextExtensions.<>c__DisplayClass1. <GetModel>b__0(XmlWriter w)
at System.Data.Entity.Migrations.Extensions.DbContextExtensions.GetModel(Action`1 writeXml)
at System.Data.Entity.Migrations.Extensions.DbContextExtensions.GetModel(DbContext context)
at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration  configuration, DbContext usersContext)
at System.Data.Entity.Migrations.DbMigrator..ctor(DbMigrationsConfiguration  configuration)
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.GetMigrator()
at     System.Data.Entity.Migrations.Design.ToolingFacade.GetPendingMigrationsRunner.RunCore()
at System.Data.Entity.Migrations.Design.ToolingFacade.BaseRunner.Run()
Value cannot be null.
Parameter name: key
PM> 

私はそれが何を意味するのか分かりません..実際のエラーを見つけるのを手伝ってくれる人はいますか??

編集:

 public class Summary
{
    [Key]
    public int Id { get; set; }

    public Guid SummaryId { get; set; }

    [Required]
    [Display(Name="Title")]
    [MaxLength(500)]
    public string SummaryTitle { get; set; }

    [Display(Name = "Description")]
    public string Description { get; set; }

    public DateTime PublishDate { get; set; }

    public virtual UserProfile Writer { get; set; }

    public bool PublishStatus { get; set; }

    [Required]
    public DateTime LastActionDate { get; set; }

    public HttpPostedFileBase DocumentFile { get; set; }
    public string FileName { get; set; }
    public string FileLocation { get; set; }

    [Required]
    public string Tag { get; set; }

    public virtual ICollection<Course> Category { get; set; }
}
4

1 に答える 1