I'm busy implementing the new Elastic Scale technnology in a project I'm working on at the moment. This technology appears to solve some complex issues we were having while designing the new application foundation.
So far, the examples look great and I'm busy implementing this in our newly created DAL.
For our application we can't rely solely on Elastic Scale in Azure. The application has to be able to run on a single instance machine, on-premise, also. Therefore I've created the following code to query the database which works quite well, also with Elastic Scale.
public IEnumerable<AnEntity> All()
{
var dbConnection = GetConnection();
using (var context = new OurDatabaseContext(dbConnection))
{
var theEntities = context.EntityTable;
return theEntities.ToArray();
}
}
private IDbConnection GetConnection()
{
var connectionInstance = connection[ConnectionStringNames.TheDatabase];
var dbConnection = connectionInstance.Create();
return dbConnection;
}
The connectionInstance
is configured via IoC which will create an IDbConnection
which we can use in the OurDatabaseContext
. All pretty much straightforward.
The main issue I'm facing is doing a MultiShardConnection
, provided by Elastic Scale and implemented in the examples.
So my question is, is it possible to use a MultiShardConnection
with a database context (like the ones of LINQ2SQL (which we are using) or EF).
If not, is the only solution to use the MultiShardConnection
in combination with the MultiShardCommand
? Or when will such a feature become available?