Abstract SQL Server & SQL Compact

Jul 17, 2013 at 9:37 PM
Edited Jul 17, 2013 at 9: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?

Thanks,
Coordinator
Jul 17, 2013 at 9: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 10: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.
Coordinator
Jul 17, 2013 at 10:13 PM
Edited Jul 17, 2013 at 10:14 PM
You might also look at ISQLBasedStore, which now that I look at it probably should have ConnectionBehavior exposed
Jul 17, 2013 at 10:27 PM
Look at it, but it doesn't expose ConnectionBehavior, nor AddType<>().
Coordinator
Jul 17, 2013 at 11:15 PM
I just fixed that so now it should meet your needs.
Jul 18, 2013 at 11:54 AM
Thanks! That works.
Jul 18, 2013 at 1: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 1:44 PM
Upon looking into it a bit more, looks like the solution is to expose CreateParameterObject in the ISQLBasedStore interface.