G
Guest
Hi all,
Our company is developing a large scale Web application with .NET and our designers can not agree on the business entities implementation. I thought I will post the case here and hope to get some opinions from the experts. Our application design is a typical n-tiers design aplication where we have a ASP.NET UI, business logic layer, and a data access layer. The final system will have a web farm with about 10 machines, another ten machines as "application servers", and Oracle database servers. Access from UI to business layer is going through .NET Remoting.
Basically we have agreed that we will use the custom business entity class instead of just pure DataSet because there are a lot of business logic in a business entity, and custom collection to hold a collection of business entities. However, there is a bit of argument involves in the physical implementation of the entity class, or be more specify, the way to represent data in implementation. One group favour the standard OO approach where we create class with attributes to hold the values. Another group want to use DataSet, DataTable as the underlying data structure to maintain relationships between entities. A Business Entity Class has "Properties" to get and set values straight from a DataColumn in a DataRow. So at runtime, each entity object has a reference to a particular DataRow object that is in a DataTable object, which is in a DataSet object. The code looks something like this
----------
case 1: Typical OO approach
Organisation
{
public String Name
{get {return name;}
set {name = value;}
}
// other properties
private string name;
}
}
-- Case 2: DataSet/Table approach
Person
{
public String Name
{ get {return (string)row["name"];}
set { row["name"] = value;}
}
// Other properties
private DataRow row;
}
---------------
Major issues are:
1. Sometime there is a need to display data in a DataGrid and allows sorting of data on different columns. We haven't been able to do the sorting with binding to ArrayList (if there is a way to get around this, please do advice). But there is argument that business layer design should be independant of UI. We should come out with a machinism to solve the formating problem on UI, but not changing the application design to suit UI.
2. Performance of system, typically database update as use cases require us to hold a major entity, and sub entities, and sub sub entities all in memory until user explicitly say "save to database", which could be a very time consuming operation.
The Microsoft consultant that we are contracting suggests that we should optimise database operations. But this is the part that really confuse me. When we are discussing the issue with DataSet, he said DataSet is more efficient in term of database operations (updating etc). And DataSet is the "standard Microsoft practice" in application development. My understanding is DataSet is very convinient in dealing with records and binding to controls, but less efficient. Also accessing DataColumn to retrieve and store value definitely involves much more operations that writing straight to a variable. Consider that we have a lot of business logic to deal with individual entity, there bound to be a lot of access to the columns, which could be an expensive operation. I haven't found any source that said DataSet is more efficient. I would very much like to hear your opinion on this.
Thanks
Our company is developing a large scale Web application with .NET and our designers can not agree on the business entities implementation. I thought I will post the case here and hope to get some opinions from the experts. Our application design is a typical n-tiers design aplication where we have a ASP.NET UI, business logic layer, and a data access layer. The final system will have a web farm with about 10 machines, another ten machines as "application servers", and Oracle database servers. Access from UI to business layer is going through .NET Remoting.
Basically we have agreed that we will use the custom business entity class instead of just pure DataSet because there are a lot of business logic in a business entity, and custom collection to hold a collection of business entities. However, there is a bit of argument involves in the physical implementation of the entity class, or be more specify, the way to represent data in implementation. One group favour the standard OO approach where we create class with attributes to hold the values. Another group want to use DataSet, DataTable as the underlying data structure to maintain relationships between entities. A Business Entity Class has "Properties" to get and set values straight from a DataColumn in a DataRow. So at runtime, each entity object has a reference to a particular DataRow object that is in a DataTable object, which is in a DataSet object. The code looks something like this
----------
case 1: Typical OO approach
Organisation
{
public String Name
{get {return name;}
set {name = value;}
}
// other properties
private string name;
}
}
-- Case 2: DataSet/Table approach
Person
{
public String Name
{ get {return (string)row["name"];}
set { row["name"] = value;}
}
// Other properties
private DataRow row;
}
---------------
Major issues are:
1. Sometime there is a need to display data in a DataGrid and allows sorting of data on different columns. We haven't been able to do the sorting with binding to ArrayList (if there is a way to get around this, please do advice). But there is argument that business layer design should be independant of UI. We should come out with a machinism to solve the formating problem on UI, but not changing the application design to suit UI.
2. Performance of system, typically database update as use cases require us to hold a major entity, and sub entities, and sub sub entities all in memory until user explicitly say "save to database", which could be a very time consuming operation.
The Microsoft consultant that we are contracting suggests that we should optimise database operations. But this is the part that really confuse me. When we are discussing the issue with DataSet, he said DataSet is more efficient in term of database operations (updating etc). And DataSet is the "standard Microsoft practice" in application development. My understanding is DataSet is very convinient in dealing with records and binding to controls, but less efficient. Also accessing DataColumn to retrieve and store value definitely involves much more operations that writing straight to a variable. Consider that we have a lot of business logic to deal with individual entity, there bound to be a lot of access to the columns, which could be an expensive operation. I haven't found any source that said DataSet is more efficient. I would very much like to hear your opinion on this.
Thanks