To try this sample you should have a SQL Azure account.
It is better to use a separate SQL azure server.

To create the federated database for this samples use sql scripts from the SQL directory:
1. First of all create the root database named FedRoot (can be changed in the web.config).
2. Then create federation.
3. Then create federated tables and other objects.
4. Create root table in the root database.
5. Populate root database table with data.
6. Populate federation members with data.
7. Split federation members.
8. Alter the connection strings in web.config files.

Code notes:
Federation.svc – OData service based on reflection data provider,
ServiceModel.cs – service model,
FederatedOData.cs – used to redirect queries to a federation member,
Query.cs – IQueryable implementation base class,
ExpressionFixingVisitor.cs – fixes incompatibilities in expressions between WCF Data Services and EF,
FederationExpressionVisitor.cs – this visitor examines an expression for a distribution key value,
FederationRootAttribute – marks the root collection entity type (see below),
FederationKeyAttribute – assigns the distribution key to each entity type,

There are 3 entities in the sample: State, County and City.
All corresponding tables are federated.
The States is the root collection. Its key is the distribution key. The corresponding table exists in the federation root also and contains all records from all members.
Each query should contain a filter by StateID except queries to the root collection (States).

Valid queries:,ID=8589934593L)/Cities$filter=StateID eq 8589934592L and Name eq 'MD'$expand=Counties/Cities$select=StateID

Invalid queries:

Empty result:$expand=Counties

Last edited Feb 15, 2012 at 7:11 PM by mglukhankov, version 1


No comments yet.