Abstract SQL Server & SQL Compact

Jul 17, 2013 at 8:37 PM
Edited Jul 17, 2013 at 8:43 PM
Is it possible to abstract away the type of datastore? I'm using SQL Compact & SQL Server.

Is SQLStoreBase<SqlEntityInfo> the right way of doing so?

Jul 17, 2013 at 8:39 PM
I what way? It's already abstracted as an IDataStore interface. I've got scenarios where I'm using up to 6 different store implementations in the same solution by all of them using the IDataStore interface.
Jul 17, 2013 at 9:09 PM
I was running into issue having the ExecuteReader function or the ConnectionBehavior exposed. Since those are "SQL specific", I'm assuming SQLStoreBase is what I'd need to use.
Jul 17, 2013 at 9:13 PM
Edited Jul 17, 2013 at 9:14 PM
You might also look at ISQLBasedStore, which now that I look at it probably should have ConnectionBehavior exposed
Jul 17, 2013 at 9:27 PM
Look at it, but it doesn't expose ConnectionBehavior, nor AddType<>().
Jul 17, 2013 at 10:15 PM
I just fixed that so now it should meet your needs.
Jul 18, 2013 at 10:54 AM
Thanks! That works.
Jul 18, 2013 at 12:30 PM
Any thoughts on being able to abstract parameters?

The following obviously dies if the store is any other than SQL server...
var params = new List<IDataParameter>
                    new SqlParameter("@previousSetupId", previousSetupId),
                    new SqlParameter("@setupId", setupId),
Jul 18, 2013 at 12:44 PM
Upon looking into it a bit more, looks like the solution is to expose CreateParameterObject in the ISQLBasedStore interface.