我有segmentation
类,它们有一些价格范围,与office
和route
相关。我想要与路线和县相关的routeCountyMap表,但每个细分只能分配一次县。
例如。 200-400细分具有 A 和 B 办公室,而 A 办公室具有 E,F,G 路线;如果在 F 路线中有 X 县,则无法进行2 * 00-400细分*。我的代码在下面,如何安排?
public class segment
{
[Key]
public Guid segmentId { get; set; }
public string name { get; set; }
public Guid organisationId { get; set; }
}
public class office
{
[Key]
public Guid officeId { get; set; }
public string name { get; set; }
public Guid segmentId { get; set; }
public segment segment { get; set; }
}
public class route
{
[Key]
public Guid routeId { get; set; }
public string name { get; set; }
public Guid officeId { get; set; }
public office office { get; set; }
}
public class county
{
[Key]
public Guid countyId { get; set; }
public string name { get; set; }
public Guid cityId { get; set; }
}
public class routeCountyMap
{
public Guid routeCountyMapId { get; set; }
public Guid routeId { get; set; }
public Guid countyId { get; set; }
public route route { get; set; }
public county county { get; set; }
}
public class user
{
[Key]
public Guid userId { get; set; }
public string name { get; set; }
}
public class routeUserMap
{
[Key]
public Guid routeUserMapId { get; set; }
public Guid routeId { get; set; }
public Guid userId { get; set; }
public route route { get; set; }
public user user { get; set; }
}