Practical .NET Data Access Layer - 13

zhaozj2021-02-16  52

Specific Data Access Logic implementation technology, the author feels no need to add more

On the aphrology, I believe that as long as there is comrades with ADO.NET development experience, what should be clear?

What to do, online information is also like smoke, very complete!

Here, the discussion about it is ended with the author's own Data Access Logic code:

Code 11: Remoting Call with Data Access Logic - 1, Basic Operation

Class Customerdal_orm: Mydal

{

Protected Internal MycustomETAllCustomers ()

{

Mycustomer Cust = NULL;

// Get the Distributed Process type

String typedist = getDistributionType ();

Switch (Typedist)

{

Case DistributionType.Remoting:

{

// Access data through cache management, the second parameter is a delegate,

/ / Once cache invalid, refresh the data directly through this delegate

ArrayList Al = CacheManager.current.getcache

GetCacheParam (), getAllCustomers_Remoting_Delegate

... // Process the data returned by Remoting

Break;

}

DEFAULT:

Throw new Exception

"Unsupported DistributionType:"

TYPEDIST "!");

}

Return CUST;

}

}

}

The above is the basic access code, because Cache Management is used, so

We also need a code that can actually access the data, once cache invalidates,

Take it again to get the data again and refresh the cache!

It is necessary to pay special attention: the above code uses anonymous in C # 2.0

DELEGATE function, if compiled in Visual Studio .NET 2003, it must be

The getAllCustomers_remoting_dlegate parameter is modified as follows:

New GetArrayList (getAllCustomers_remoting_dlegate)

(Here GetArrayList is the real defined delegate type)

Next: http://www.9cbs.net/develop/read_article.asp? Id = 27557

转载请注明原文地址:https://www.9cbs.com/read-24095.html

New Post(0)