2. Data Entity Façade
Code 2: Traditional Data Entity
// Customer1: Customer containing basic fields, generic Data Entity
[Serializable ()]
Public Class Customer1: XXX // XXX indicates that the base class that may exist
{
Public String ID;
Public String Name;
Public string phone;
Public Customer1 () {...}
}
// Customer2: Customer inherited from DataSet, also known as Typed DataSet
[Serializable ()]
Public class customer2: system.data.dataset
{
Private CustomersDataTable TablecuStomers;
Private OrdersDataTable TableRDERS;
Private DataRelation RELATIONFK_ORDERS_CUSTOMERS;
Public Customer2 () {...}
...
}
In fact, there are also a mixed mode in some programs, such as:
DataSet inherits (simple can inherit from DataTable), but only TYPED
DataSet's partial features; or, although the basic field is included, it is implemented inside.
Data fill or conversion (in PETSHOP, data is acquired by DAL in Reader)
And filled to Data Entity, did not use Data Entity to convert directly);
One most thorough way: directly using Reader as Data Entity for Cross
Layer data exchange! In this way, performance is the highest, but also give other Layer developers
Brought some unnecessary troubles L.
For Data Entity that only contains basic fields, it is very simple, but also
Can write a program in a manner that is more familiar, however, the cost of pay is not small:
In more complicated case, don't be so heart-shouldable, even if Framework
It provides these features, but it is not Ease of Use, this can be taken from Borland Eco
OCL in the OPATH in one or two, .NET Framework ObjectSpaces
It is also half a catty eight two L)!
Fortunately, the above shortcomings are the interatrays of Typed DataSet!
Although the body is huge, it is not a flexible, this is the "ritual of ADO.NET brings us"
"J Have admitted that although type Dataset can lead to a series of issues (sex
Can, maintenance), but sometimes we are really willing to experience this "pain, and happy"
Feeling (of course, this feeling is not limited to Ease of Use when processing complex case
Experience)!
Duwamish did this, the authors did so, do you
Also prepared to do this (system architects are unable to make big thunder J)?
OK, say so much, just a purpose: of course, "grand launch" author "bitter
Heart is alone, but it has been "decisive" system architect "veto" Data Entity!
No chance, take it, first send a manuscript to here, wait for everyone to discuss discussions, see if there is a day J. Next paragraph: http://www.9cbs.net/develop/read_article.asp? Id = 27546