首页 > 解决方案 > Codefirst 的实体框架迁移错误

问题描述

我正在尝试使用 postgresql 在我的项目中启用迁移,但是当我在包管理器控制台中运行 Enable-Migrations 时遇到此错误。我已经尝试卸载并重新安装实体框架。

Enable-Migrations : Cannot bind argument to parameter 'Path' because it is null.
At line:1 char:1
+ Enable-Migrations
+ ~~~~~~~~~~~~~~~~~
    + CategoryInfo          : InvalidData: (:) [Enable-Migrations], ParameterBindingValidationException
    + FullyQualifiedErrorId : ParameterArgumentValidationErrorNullNotAllowed,Enable-Migrations

数据库上下文:

using System.Data.Entity;

namespace HalfPugg.Models
{
    public class HalfPuggContext : DbContext
    {
        public HalfPuggContext() : base("Half-Pugg")
        {

        }

        public DbSet<Gamer> Gamers { get; set; }

        public DbSet<Game> Games { get; set; }

        public DbSet<Classification_Gamer> Classification_Gamers { get; set; }

        public DbSet<Match> Matches { get; set; }

        public DbSet<Classification_Game> Classification_Games { get; set; }

        public DbSet<Classification_Match> Classification_Matchs { get; set; }

        public DbSet<Filter> Filters { get; set; }

        public DbSet<Group> Groups { get; set; }

        public DbSet<Hall> Halls { get; set; }

        public DbSet<HashTag> HashTags { get; set; }

        public DbSet<Label> Labels { get; set; }

        public DbSet<MessageGamer> MessageGamers { get; set; }

        public DbSet<MessageGroup> MessageGroups { get; set; }

        public DbSet<MessageHall> MessageHalls { get; set; }

        public DbSet<Numbered> Numbereds { get; set; }

        public DbSet<Range> Ranges { get; set; }

        public DbSet<RequestedGroup> RequestedGroups { get; set; }

        public DbSet<RequestedHall> RequestedHalls { get; set; }

        public DbSet<RequestedMatch> RequestedMatchs { get; set; }

        public DbSet<Template> Templates { get; set; }

    }
}

标签: c#entity-frameworkentity-framework-6migrationcode-first

解决方案


推荐阅读