Skip to content

Commit

Permalink
Tweaked the database provider code to use the provider as defined in …
Browse files Browse the repository at this point in the history
…the connection string if one is available. This solved an issue when trying to use a Sql Compact Database 4.0 provider with Massive.
  • Loading branch information
KennyBu committed Dec 1, 2011
1 parent ab987bf commit ac6a513
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions Massive.cs
Expand Up @@ -119,6 +119,10 @@ public class DynamicModel : DynamicObject {
PrimaryKeyField = string.IsNullOrEmpty(primaryKeyField) ? "ID" : primaryKeyField;
DescriptorField = descriptorField;
var _providerName = "System.Data.SqlClient";

if(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName != null)
_providerName = ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName;

_factory = DbProviderFactories.GetFactory(_providerName);
ConnectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString;
}
Expand Down

0 comments on commit ac6a513

Please sign in to comment.