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);
}
}