1
내가 가지고있는 SQL 서버의보기에 연결되어이 클래스 :반환 목록 - 엔티티 프레임 워크
public ActionResult Index()
{
var clients = db.Clients.Include(c => c.Branch).Include(c => c.City).Include(c => c.Zone).Include(c => c.SubZone).Include(c => c.Vendor).Include(c => c.PriceLists).Include(c => c.Collector);
return View(clients.ToList());
}
:
[Table("V_Clients")]
public class Client
{
[Key]
public int ClientId { get; set; }
public short BranchId { get; set; }
public string CorporateName { get; set; }
public string TIN { get; set; }
public string Address { get; set; }
public string Phone { get; set; }
public string Id { get; set; }//NroCi
public short CityId { get; set; }
public short ZoneId { get; set; }
public short SubZoneId { get; set; }
public short VendorId { get; set; }
public short PriceListId { get; set; }
public short CollectorId { get; set; }
[ForeignKey("BranchId")]
public virtual Branch Branch { get; set; }
[ForeignKey("CityId")]
public virtual City City { get; set; }
[ForeignKey("ZoneId")]
public virtual Zone Zone { get; set; }
[ForeignKey("SubZoneId")]
public virtual SubZone SubZone { get; set; }
[ForeignKey("VendorId")]
public virtual Vendor Vendor { get; set; }
[ForeignKey("PriceListId")]
public virtual PriceList PriceLists {get;set;}
[ForeignKey("CollectorId")]
public virtual Collector Collector { get; set; }
}
하지만 난 이런 식으로 목록을 만들려고 할 때
아무 일도 발생하지 않습니다. 관계 때문일 수 있습니까?
참고 : 모든 클래스는 뷰에 연결되어 있으며 Client
클래스를 제외한 다른 클래스와 잘 작동합니다.
나는 거의 모든 것을 시도하고 나는 결론으로 끝날 : "전망 건강한지도 엔티티 프레임 워크 아닌가". 해결되었습니다. – Hugo