.Net performance: Improve Grid performance
Performance is not an inbuilt feature it can only be achieved only through proper software designing and coding. .Net performance also makes use of this methodology to build working software. No software is perfect it has some kind of bugs in them and has a drastic effect on the performance of the software. .Net performance can be checked by using their features such as sorting, filtering, cell highlighting or deletion.
In case of non-event based model, grid doesn’t use the INotifyPropertyChanged interface. The data can be updated using a simple method i.e. Cell.Value. This method can be invoked by any thread including the GUIO thread. To save the application from any deadlock situation synchronized thread of the grid with the help of synchronized Control.Invoke() method is called for the purpose of .Net performance.
grid.Rows.Add(new object[]{"value1", 123, true, DateTime.Now});
//Data is updated by calling Cell.Value property.
Row row = ...;
Cell cell = row[0] ;
cell.Value = "value2";
.Net performance while updating depends on the numbers of data present on the grid. In other words, if there is more number of data on the grid, more the effect on the .Net performance. This issue of .Net performance is considered by Dapfor while developing application.
In case of sorting, the .Net performance also takes a huge hit. But if the development of the software is done properly the effect can be negated. If the data sorting is an event based model then the grid will use the INotifyPropertyChanged interface. The Row.Update() method is invoked whenever the grid receives any notifications. If the grid doesn’t implement the INotifyPropertyChanged interface then Row.Update() method is called upon the modification of the data which is good for the .Net performance.
Using this method tremendously improves the .Net performance because the volumes of codes are reduced. The developers need not to worry about the data which is present on the grid; the grid will automatically sort them for the user. This is what makes the Dapfor applications unique and improves the .Net performance. Customized sorting can also be done using the features of the Dapfor and the .Net performance is automatically maintained.
class MyCystomSort : ICustomSort
{
public int Compare(Row row1, Row row2, string fieldId, object value1, object value2, int defaultResult)
{
string v1 = value1.ToString();
string v2 = value2.ToString();
if (v1 == "some value") return -1;
if (v2 == "some value") return 1;
return defaultResult;
}
}
grid.CustomSort = new MyCystomSort();
Another very important feature of the Dapfor is data grouping. In this case also the .Net performance must be maintained. Single and multiple grouping are possible on the grid. Programmatically it can be setting the Column.Grouped attribute to true.
Header header = grid.Headers[0];
header["Status"].Grouped = true;
header["Status"].Visible = false;
To make it more easy and simple, the drag and drop facility is incorporated in the application which doesn’t have any negative impact on the .Net performance.
In case of non-event based model, grid doesn’t use the INotifyPropertyChanged interface. The data can be updated using a simple method i.e. Cell.Value. This method can be invoked by any thread including the GUIO thread. To save the application from any deadlock situation synchronized thread of the grid with the help of synchronized Control.Invoke() method is called for the purpose of .Net performance.
grid.Rows.Add(new object[]{"value1", 123, true, DateTime.Now});
//Data is updated by calling Cell.Value property.
Row row = ...;
Cell cell = row[0] ;
cell.Value = "value2";
.Net performance while updating depends on the numbers of data present on the grid. In other words, if there is more number of data on the grid, more the effect on the .Net performance. This issue of .Net performance is considered by Dapfor while developing application.
In case of sorting, the .Net performance also takes a huge hit. But if the development of the software is done properly the effect can be negated. If the data sorting is an event based model then the grid will use the INotifyPropertyChanged interface. The Row.Update() method is invoked whenever the grid receives any notifications. If the grid doesn’t implement the INotifyPropertyChanged interface then Row.Update() method is called upon the modification of the data which is good for the .Net performance.
Using this method tremendously improves the .Net performance because the volumes of codes are reduced. The developers need not to worry about the data which is present on the grid; the grid will automatically sort them for the user. This is what makes the Dapfor applications unique and improves the .Net performance. Customized sorting can also be done using the features of the Dapfor and the .Net performance is automatically maintained.
class MyCystomSort : ICustomSort
{
public int Compare(Row row1, Row row2, string fieldId, object value1, object value2, int defaultResult)
{
string v1 = value1.ToString();
string v2 = value2.ToString();
if (v1 == "some value") return -1;
if (v2 == "some value") return 1;
return defaultResult;
}
}
grid.CustomSort = new MyCystomSort();
Another very important feature of the Dapfor is data grouping. In this case also the .Net performance must be maintained. Single and multiple grouping are possible on the grid. Programmatically it can be setting the Column.Grouped attribute to true.
Header header = grid.Headers[0];
header["Status"].Grouped = true;
header["Status"].Visible = false;
To make it more easy and simple, the drag and drop facility is incorporated in the application which doesn’t have any negative impact on the .Net performance.