Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

Already on GitHub? Sign in to your account

Added DbConnectionStringBuilder constructors #137

Closed
wants to merge 4 commits into
from

Conversation

Projects
None yet
2 participants

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);

}

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.

Contributor

robconery commented May 2, 2012

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 May 2, 2012

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment