Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Added DbConnectionStringBuilder constructors #137

Closed
wants to merge 4 commits into from

2 participants

@DoggettCK

I absolutely love Massive. I have to deal with a bunch of Access MDB files that get uploaded to a shared directory, and it's too much of a pain to constantly update my app.config with new connection strings, so I've added a new constructor that takes a System.Data.Common.DbConnectionStringBuilder, which I can build on the fly from filenames or other properties.

Assuming you have the correct drivers, you can use any of the following:

System.Data.EntityClient.EntityConnectionStringBuilder
System.Data.Odbc.OdbcConnectionStringBuilder
System.Data.OleDb.OleDbConnectionStringBuilder
System.Data.OracleClient.OracleConnectionStringBuilder
System.Data.SqlClient.SqlConnectionStringBuilder

Example:

foreach (string filename in Directory.EnumerateFiles(dataDirectory, "*.mdb"))
{
var accessBuilder = new OleDbConnectionStringBuilder
{
Provider = "Microsoft.Jet.OLEDB.4.0",
DataSource = filename
};

accessBuilder["ProviderName"] = "System.Data.OleDb";

var patientExtract = new PatientExtract(accessBuilder);
Console.WriteLine("Patient Count: {0}\tFile: {1}", patientExtract.Count(), filename);

}

@DoggettCK

Also, there shouldn't be that many additions/deletions. I think something went screwy with Github's online editor. The only change should be a new constructor right under the original ones in DynamicModel.

@robconery
Collaborator

This looks lovely and thank you for the thought :). I would suggest, however, it's a "1-off" which means it applies to your situation but perhaps not everyone that uses Massive.

@robconery robconery closed this
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.