This project is read-only.

'PropertyChangedEventHandler' not found

May 20, 2011 at 10:08 PM

I am trying to compile a little test app. 

I generated the persistents using the wizard, and telling it to implement IObjectNotification, ISelfContainingObject, INotifyPropertyChanged interfaces.

When I try to compile the persisten classes, the compiler complaints that the name INotifyPropertyChanged does not exists.

But diving in the code, in the file ObjectSet_1.cs I can see some references to that interface. 

Could someone explain me how is this?

TIA

Marcelo

 

May 22, 2011 at 12:55 AM

Hi Marcelo,

can you post one of the objects that you created here?

Thanks,
-Christian 

May 22, 2011 at 3:59 PM

Ok, Christian, here it´s one of the classes.  The INotifyPropertyChanged implementation  is  near   the end.

Thank you.

Marcelo

#region Developer's comment header
/* Detail.cs
 *
 * author:    marcelo
 * copyright: © 2006 -. All rights reserved.
 *
 * history:   22/05/2011, marcelo: Created.
 *
 */
#endregion
#region Using directives

using System;
using System.Collections.Generic;
using System.Text;
using System.ComponentModel;
using System.Xml.Serialization;

using Chili.Opf3;
using Chili.Opf3.Relations;


#endregion

namespace opf3.modelo
{
 /// <summary>
 /// Persistent object for the "detail" table.
 /// </summary>
 [Serializable]
 [Persistent("detail")]
 public partial class Detail : IObjectNotification, ISelfContainingObject, INotifyPropertyChanged
 {
  #region Fields

  private int _id;
  private int _masterID;
  private string _detcomment;

  #endregion

  #region Relations

  [Relation("MasterID = id", PersistRelationship = PersistRelationships.ChildFirst)]
  private ObjectHolder<Master> _master = new ObjectHolder<Master>();

  /// <summary>
  /// Specifies the connected "Master" persistent object.
  /// </summary>
  [XmlIgnore]
  public Master Master
  {
   get { return _master.InnerObject; }
   set { _master.InnerObject = value; }
  }

  #endregion

  #region Properties

  /// <summary>
  /// Returns the identifier of the persistent object. Don't set it manually!
  /// </summary>
  [Field("id", AllowDBNull = false, Identifier = true, AutoNumber = true)]
  public int id
  {
   get
   {
    return _id;
   }
   private set
   {
    _id = value;

    OnRowChanged("id");
   }
  }

  /// <summary>
  /// The foreign key connected with another persistent object.
  /// </summary>
  [Field("master_id", AllowDBNull = false)]
  public int MasterID
  {
   get
   {
    return _masterID;
   }
   private set
   {
    _masterID = value;

    OnRowChanged("MasterID");
   }
  }

  /// <summary>
  /// This property is mapped to the "detcomment" field. Length must be between 0 and 50 characters. Mandatory.
  /// Storage comment: .
  /// </summary>
  [Field("detcomment", AllowDBNull = false)]
  public string Detcomment
  {
   get
   {
    return _detcomment;
   }
   set
   {
    if (value == null)
     throw new ArgumentNullException("value", "Value is null.");
    if (value != null && value.Length > 50)
     throw new ArgumentException("Value length must be between 0 and 50 characters.");

    _detcomment = value;

    OnRowChanged("Detcomment");
   }
  }

  #endregion

  #region IObjectNotification Members

  /// <summary>
  /// Invoked by the framework before the persistent object is populated.
  /// </summary>
  /// <param name="e">
  /// Contain information about the state of the persistent object and the
  /// <see cref="Opf3.ObjectContext">ObjectContext</see> of the current operation.
  /// </param>
  void IObjectNotification.OnBeforePopulated(ObjectNotificationEventArgs e)
  {
   // Add code here, if required. Leave empty if the event is not required.
  }

  /// <summary>
  /// Invoked by the framework after the object is populated.
  /// </summary>
  /// <param name="e">
  /// Contain information about the state of the persistent object and the
  /// <see cref="Opf3.ObjectContext">ObjectContext</see> of the current operation.
  /// </param>
  void IObjectNotification.OnAfterPopulated(ObjectNotificationEventArgs e)
  {
   // Add code here, if required. Leave empty if the event is not required.
  }

  /// <summary>
  /// Invoked by the framework before the object is inserted.
  /// </summary>
  /// <param name="e">
  /// Contain information about the state of the persistent object and the
  /// <see cref="Opf3.ObjectContext">ObjectContext</see> of the current operation.
  /// </param>
  void IObjectNotification.OnBeforeInsert(ObjectNotificationEventArgs e)
  {
   // Add code here, if required. Leave empty if the event is not required.
  }

  /// <summary>
  /// Invoked by the framework after the object is inserted.
  /// </summary>
  /// <param name="e">
  /// Contain information about the state of the persistent object and the
  /// <see cref="Opf3.ObjectContext">ObjectContext</see> of the current operation.
  /// </param>
  void IObjectNotification.OnAfterInsert(ObjectNotificationEventArgs e)
  {
   // Add code here, if required. Leave empty if the event is not required.
  }

  /// <summary>
  /// Invoked by the framework before the object is updated.
  /// </summary>
  /// <param name="e">
  /// Contain information about the state of the persistent object and the
  /// <see cref="Opf3.ObjectContext">ObjectContext</see> of the current operation.
  /// </param>
  void IObjectNotification.OnBeforeUpdate(ObjectNotificationEventArgs e)
  {
   // Add code here, if required. Leave empty if the event is not required.
  }

  /// <summary>
  /// Invoked by the framework after the object is updated.
  /// </summary>
  /// <param name="e">
  /// Contain information about the state of the persistent object and the
  /// <see cref="Opf3.ObjectContext">ObjectContext</see> of the current operation.
  /// </param>
  void IObjectNotification.OnAfterUpdate(ObjectNotificationEventArgs e)
  {
   // Add code here, if required. Leave empty if the event is not required.
  }

  /// <summary>
  /// Invoked by the framework before the object is deleted.
  /// </summary>
  /// <param name="e">
  /// Contain information about the state of the persistent object and the
  /// <see cref="Opf3.ObjectContext">ObjectContext</see> of the current operation.
  /// </param>
  void IObjectNotification.OnBeforeDelete(ObjectNotificationEventArgs e)
  {
   // Add code here, if required. Leave empty if the event is not required.
  }

  /// <summary>
  /// Invoked by the framework after the object is deleted.
  /// </summary>
  /// <param name="e">
  /// Contain information about the state of the persistent object and the
  /// <see cref="Opf3.ObjectContext">ObjectContext</see> of the current operation.
  /// </param>
  void IObjectNotification.OnAfterDelete(ObjectNotificationEventArgs e)
  {
   // Add code here, if required. Leave empty if the event is not required.
  }

  /// <summary>
  /// Invoked by the framework after the object has been marked deleted.
  /// </summary>
  /// <param name="e">
  /// Contain information about the state of the persistent object and the
  /// <see cref="Opf3.ObjectContext">ObjectContext</see> of the current operation.
  /// </param>
  void IObjectNotification.OnBeforeMarkDeleted(ObjectNotificationEventArgs e)
  {
   // Add code here, if required. Leave empty if the event is not required.
  }

  /// <summary>
  /// Invoked by the framework after the object has been marked deleted.
  /// </summary>
  /// <param name="e">
  /// Contain information about the state of the persistent object and the
  /// <see cref="Opf3.ObjectContext">ObjectContext</see> of the current operation.
  /// </param>
  void IObjectNotification.OnAfterMarkDeleted(ObjectNotificationEventArgs e)
  {
   // Add code here, if required. Leave empty if the event is not required.
  }

  #endregion

  #region ISelfContainingObject Members

  private ObjectInfo _objectInfo = null;

  /// <summary>
  /// Returns the <see cref="Opf3.ObjectInfo">ObjectInfo</see> object that contains all
  /// information required to make the persistent object
  /// <see cref="Opf3.ObjectContext">independent from any ObjectContext</see>.
  /// </summary>
  /// <value>
  ///  <see cref="Opf3.ObjectInfo">ObjectInfo</see> object that holds the status
  /// information of the persistent object.
  /// </value>
  ObjectInfo ISelfContainingObject.ObjectInfo
  {
   get { return _objectInfo; }
   set { _objectInfo = value; }
  }

  #endregion

  #region INotifyPropertyChanged Members

  /// <summary>
  /// Invokes the "PropertyChanged" event if a property has been changed and
  /// somebody subscribed the event.
  /// </summary>
  private void OnRowChanged(string propertyName)
  {
   if (PropertyChanged != null)
    PropertyChanged(this, new PropertyChangedEventArgs(propertyName));
  }

  /// <summary>
  /// Event is fired if a property of the persistent changed.
  /// </summary>
  public event PropertyChangedEventHandler PropertyChanged;

  #endregion
 }
}

 

May 26, 2011 at 5:58 PM

Hi, Christian

Sorry, I'm not very proficient regarding the .NET infrastructure, and so I dont realised that INotifyPropertyChanged was a native interface, not a Opf3 one...

Thank you anyway

Marcelo