Database Reference
In-Depth Information
Figure 10-1 . Shard library object diagram
A sample application is provided to demonstrate how to use the shard library. Although the
application is very simple, it uses all the features of the shard for reference.
Note Check http://EnzoSqlShard.Codeplex.com for the latest shard library. This shard library is made
available as an open source project.
Managing Database Connections
This section walks through a few coding decisions that are necessary when creating this shard. Because
the shard library needs to be able to connect to multiple databases, the client has two options to provide
this list: it can provide the list of connections to use whenever it makes a call to the library, or it can
preload the library with a list of connection objects that are then kept in memory for all future calls.
The shard library declares the following property to hold the list of preloaded connection objects.
The ShardConnections property is declared as static so it can be used across multiple calls easily; the
client application only needs to set this property once:
public static List<SqlConnection> ShardConnections {get;set;}
In addition, an extension method is added to SqlConnection to provide a GUID value that uniquely
identifies a connection string. The connection GUID is critical for the shard; it provides a breadcrumb
Search WWH ::




Custom Search