Database Reference
In-Depth Information
want to consider using a lazy loading mechanism by which certain properties of your objects are loaded
only when necessary. LINQ to SQL and the Entity Framework 4.0 support lazy loading (through the use
of the DeferredLoadingEnabled property).
Although lazy loading minimizes the amount of data loaded, it also creates a chattier application by
design. It's important to strike the right balance between using bulk data transfers and minimizing the
amount of data needed to run an application function.
Caching
Another important technique used to minimize roundtrips is caching . Your application (or service) may
use caching to avoid unnecessary roundtrips if some of your data doesn't change often. This may also
impact your database design choices. For example, if you have a table that stores a list of states, the table
will probably remain unchanged for a long time, which makes it a great candidate for caching.
Caching can be performed in memory or on disk (in a local database, for example). You have a few
options:
ASP.NET caching . ASP.NET offers a cache object that provides good caching
capabilities. However, ASP.NET caching is tied to IIS. Restarting IIS clears the
ASP.NET cache unless you've taken the necessary steps to persist the cache.
Windows Server AppFabric . The AppFabric offers a next-generation distributed
cache (previously known as Velocity). This cache can run on multiple computers
and is made available through a .NET API.
Enterprise Library . The Enterprise Library offers a collection of application blocks
that Microsoft makes available under public license. The Enterprise Library
contains a cache mechanism that doesn't depend on ASP.NET. This caching
mechanism is provided natively in .NET 4.0 and can be found under the
System.Runtime.Caching namespace.
Asynchronous User Interface
Ultimately, performance is a measure that impacts the user experience and can be controlled to a
certain degree by offering highly responsive user interfaces. A Windows application that becomes
unresponsive while loading data, or a web page that doesn't load until all the data has been retrieved, is
perceived as slow. As a result, developing with multithreading techniques may become more important
to provide a better experience to your users.
For web development, you should consider using asynchronous controls (such as AJAX) that give
you more control over partial page loading. For Windows development, you may need to use a
multithreaded user interface development approach.
To implement a highly responsive application in WinForms, use the Invoke method, shown on line 3
of the following example, to refresh your user interface on the UI thread:
1)
void OnPassCompleted()
2)
{
3)
this.Invoke(new EventHandler(UpdateProgressBar), null);
4)
}
5)
6)
private void UpdateProgressBar(object o, System.EventArgs e)
7)
{
8)
if (progressBarTest.Value < progressBarTest.Maximum)
Search WWH ::




Custom Search