Help me error Invalid column name

This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.
Hace 7 años
Help fail: "SqlException: Invalid column name 'HospitalId'."
i'm create 2class Hospital and Department in my project nopcommerce, when i build fail.Help me please

Department.cs :
public partial class Department : BaseEntity, ILocalizedEntity
    {
        public string ShortName { get; set; }
        public string Name { get; set; }
        public int? HospitalId { get; set; }
        public virtual Hospital hospital { get; set; }
        
    }


Hospital.cs :
public partial class Hospital : BaseEntity, ILocalizedEntity
    {        
        public string ShortName { get; set; }
        public string Name { get; set; }
        public bool Register { get; set; }
        
        public virtual ICollection<Department> Departments { get; set; }
    }


DepartmentMap.cs :
public class DepartmentMap : NopEntityTypeConfiguration<Department>
    {
        public DepartmentMap()
        {
            this.ToTable("Department");
            this.HasKey(d => d.Id);
            this.HasRequired(d => d.hospital)
                .WithMany(h => h.Departments)
                .HasForeignKey(d => d.HospitalId);
        }
    }
Hace 7 años
please help me
Hace 7 años
See https://www.nopcommerce.com/boards/t/14123/step-by-step-tutorial-for-adding-a-new-table-to-nopcommerce-23.aspx#92781
This topic was automatically closed 365 days after the last reply. New replies are no longer allowed.