Hello :)
Linq to Sql automatically generates classes that represents the relational tables of sql server as Objects in C#.
This Linq to Sql classes implements the INotifyPropertyChanging and INotifyPropertyChanged like this:
If I bind the ItemSource of a RadGridView to a ObservableCollection of this classes generated by Linq to Sql, is necessary to do anything else in order to the gridview automatically updates its rows data or add and remove rows by just updating the ObservableCollection? Because the gridview is not updating its data.
I hope you can help me.
Best regards, Jorge
Linq to Sql automatically generates classes that represents the relational tables of sql server as Objects in C#.
This Linq to Sql classes implements the INotifyPropertyChanging and INotifyPropertyChanged like this:
[Table(Name="dbo.hotel")] public partial class hotel : INotifyPropertyChanging, INotifyPropertyChanged { private static PropertyChangingEventArgs emptyChangingEventArgs = new PropertyChangingEventArgs(String.Empty); private int _idHotel; private int _ProveedorEmpresa_idProveedorEmpresa; #region Extensibility Method Definitions partial void OnLoaded(); partial void OnValidate(System.Data.Linq.ChangeAction action); partial void OnCreated(); partial void OnidHotelChanging(int value); partial void OnidHotelChanged(); partial void OnProveedorEmpresa_idProveedorEmpresaChanging(int value); partial void OnProveedorEmpresa_idProveedorEmpresaChanged(); #endregion public hotel() { OnCreated(); } [Column(Storage="_idHotel", AutoSync=AutoSync.OnInsert, DbType="Int NOT NULL IDENTITY", IsPrimaryKey=true, IsDbGenerated=true)] public int idHotel { get { return this._idHotel; } set { if ((this._idHotel != value)) { this.OnidHotelChanging(value); this.SendPropertyChanging(); this._idHotel = value; this.SendPropertyChanged("idHotel"); this.OnidHotelChanged(); } } } [Column(Storage="_ProveedorEmpresa_idProveedorEmpresa", DbType="Int NOT NULL")] public int ProveedorEmpresa_idProveedorEmpresa { get { return this._ProveedorEmpresa_idProveedorEmpresa; } set { if ((this._ProveedorEmpresa_idProveedorEmpresa != value)) { this.OnProveedorEmpresa_idProveedorEmpresaChanging(value); this.SendPropertyChanging(); this._ProveedorEmpresa_idProveedorEmpresa = value; this.SendPropertyChanged("ProveedorEmpresa_idProveedorEmpresa"); this.OnProveedorEmpresa_idProveedorEmpresaChanged(); } } } public event PropertyChangingEventHandler PropertyChanging; public event PropertyChangedEventHandler PropertyChanged; protected virtual void SendPropertyChanging() { if ((this.PropertyChanging != null)) { this.PropertyChanging(this, emptyChangingEventArgs); } } protected virtual void SendPropertyChanged(String propertyName) { if ((this.PropertyChanged != null)) { this.PropertyChanged(this, new PropertyChangedEventArgs(propertyName)); } } }If I bind the ItemSource of a RadGridView to a ObservableCollection of this classes generated by Linq to Sql, is necessary to do anything else in order to the gridview automatically updates its rows data or add and remove rows by just updating the ObservableCollection? Because the gridview is not updating its data.
I hope you can help me.
Best regards, Jorge
