2012-06-29 3 views
0
데이터베이스 첫 번째 시나리오와

, 나는이 많은이하여 PropertyChanged - 많은 관계를하고 ORM & DAL로 EF를 사용부분 클래스 엔티티 프레임 워크는

고객 : ID, 이름, 주소 || 제품 : ID, 이름 || CustomerProduct : CutomerID, ProductID

Isincludedforcustomer라는 Product 엔터티 클래스에 사용자 지정 속성을 추가합니다.

public partial class Product: EntityObject 
{ 
    public bool isincludedforcustomer; 
    public bool Isincludedforcustomer 
    { 
     get { return isincludedforcustomer; } 
     set {isincludedforcustomer= value; } 
    } 

고객이 선택되면 새로운 속성을 할당하는 방법이 있습니다.

IsProductinclinframe(Displayedcustomerproducts, products); 

속성을이 속성으로 어떻게 구현할 수 있습니까?

+1

아래 답변이 만족스러운 경우 답변으로 표시하고/또는 upvote로 지정하십시오. 이 커뮤니티는 평판 시스템에서 번창합니다. – CodeWarrior

답변

2

일반적으로 속성 설정자의 PropertyChanged 이벤트를 호출합니다.

public partial class Product: EntityObject, INotifyPropertyChanged 
{ 
    public bool isincludedforcustomer; 
    public bool Isincludedforcustomer 
    { 
     get { return isincludedforcustomer; } 
     set 
     { 
      isincludedforcustomer= value; 
      RaisePropertyChanged("Isincludedforcustomer"); 
     } 
    } 

    public event PropertyChangedEventHandler PropertyChanged; 

    private void NotifyPropertyChanged(String info) 
    { 
     if (PropertyChanged != null) 
     { 
      PropertyChanged(this, new PropertyChangedEventArgs(info)); 
     } 
    } 
} 
관련 문제