I am busy introducing new Elastic Scale technology in a project that I am currently working on. This technology, apparently, solves some complex problems that arise when developing a new fund of applications.
So far, the examples look great, and I'm busy implementing this in our newly created DAL.
For our application, we cannot rely solely on Elastic Scale in Azure. The application should also run on the same instance machine, including. So I created the following code to query a database that works quite well, also using 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; }
connectionInstance
configured through an IoC that will create an IDbConnection
that we can use in OurDatabaseContext
. Everything is pretty simple.
The main problem I ran into was making a MultiShardConnection
provided by Elastic Scale and implemented in the examples.
So my question is: is it possible to use MultiShardConnection
with a database context (e.g. LINQ2SQL (which we use) or EF).
If not, is the only solution to use MultiShardConnection
in conjunction with MultiShardCommand
? Or when will this feature become available?
Jan_V source share