Combat. Net data Access Layer-5

Source: Internet
Author: User
Access to | Data code 4: Data Entity in my data entity–2,framework

Dafbase: Provides the basic data entity support required by most applications,

including collection,ado.net

[Serializable ()]

Public abstract class Defbase:ilist, IDictionary

{

protected internal string _typeentity = Entitytype.object;



Collection fields

protected internal ArrayList _al = null;

protected internal Hashtable _ht = null;



Ado.net Fields

protected internal DataSet _DST = null;

protected internal DataTable _tbl = null;

[NonSerialized ()]

protected internal DbDataReader _rdr = null;



Public defbase () {}

Public Defbase (ArrayList al)

{

This._al = al;

this._typeentity = entitytype.collection_arraylist;

}

...

Public Defbase (DataSet DST)

{

THIS._DST = DST;

this._typeentity = Entitytype.adox_dataset;

}

Public Defbase (DataTable tbl)

{

THIS._TBL = TBL;

this._typeentity = entitytype.adox_table;

}

...

}

















































































Above, is my data entity demo (finally see people again J), is not

Does it feel cool?

Frankly speaking, according to my conservative estimate, more than 80% of friends will have the idea of "disagree", and the other 15% may be uncertain, there is always déjà vu (four not like?). But not the same taste. As for the remaining 5%, I am not very clear (hope is like-minded bar), if you have an email telling me "This is what I want, please give me a source code", I would not hesitate to offer immediately and no longer consider any license problems (if not received within 1 days, Please believe that the author is happy to faint, or the Internet is a problem j)!



Ok, briefly explain:

Maybe you've noticed a problem where def doesn't seem to be data.

entity abbreviation, then, what does this "F" really mean?

As mentioned earlier, the author of this data access layer solution is named "Façade" (DAF), which is of course the Façade pattern in the GOF23 bar, so, in view of this, the "F" in Def also contains the Façade meaning!



Is it a little complicated? Dizzy? It doesn't matter, and listen to one by one ways!



The two classical data entity modes given in Code 2 have their obvious advantages and disadvantages, basically, in terms of the author's understanding of the situation, the actual development is in a unified way to make a choice, it is inevitable to the left (always some cases are simple, and always some cases are a headache). If, plus other factors that must be considered in the system architecture, such as security, performance, scalability (interface/base class), scalability (load balancing/distributed processing), and so on, for a slightly enterprise application, it's not hard to understand why data Access Layer always so people love and hate (Sigh,data entity only Long March first step ah L)!



Therefore, in order to solve this problem, the author feels the need to make a relatively generic solution, the first problem to be solved is: Data entity!

The so-called Def, of course, is: Data Entity Façade, plainly, is to a

The way to show the data in front of you! The consensus here is not just to show consistent access in the current application (Interface), but also to ensure that different data entity models (STORAGE) are supported under consistent Interface. And all of this is hidden behind a specially built data Entity, which is the first step in the author's DAF Solution: Data Entity façade! The short name is: Def.



Next paragraph: http://www.csdn.net/develop/Read_Article.asp?id=27548


Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.