I have a property auto-generated from database in my edmx: Description. I then create a "partial class" .cs file for the entity and add a read-only property: ShortDescription. ShortDescription's getter simply processes Desc开发者_JAVA百科ription (removes line feed, carriage return, etc).
How can I raise property change notification for ShortDescription on the setter of Description?
Thanks!
This is going to be a hack, but it can be done.
First, you need to override ReportPropertyChanging and ReportPropertyChanged. Then check the parameter for the name of your property... in this case "Description". If it occurs, call ReportPropertyChanging or ReportPropertyChanged with the derived property name, in this case "ShortDescription". For any other value of the parameter, call the base version of ReportPropertyChanging/Changed. 
Edit: For example:
    protected override void OnPropertyChanging(string property)
    {
        if (property == "Description")
        {
            base.OnPropertyChanging("ShortDescription");
        }
        base.OnPropertyChanging(property);
    }
    protected override void OnPropertyChanged(string property)
    {
        if (property == "Description")
        {
            base.OnPropertyChanged("ShortDescription");
        }
        base.OnPropertyChanged(property);
    }
The methods are partial also, so in your partial class you can add code like this
 partial void OnDescriptionChanged()
  {
    OnPropertyChanged("ShortDescription"); 
  }
 
         
                                         
                                         
                                         
                                        ![Interactive visualization of a graph in python [closed]](https://www.devze.com/res/2023/04-10/09/92d32fe8c0d22fb96bd6f6e8b7d1f457.gif) 
                                         
                                         
                                         
                                         加载中,请稍侯......
 加载中,请稍侯......
      
精彩评论