Created
August 17, 2013 20:54
-
-
Save xivSolutions/6258658 to your computer and use it in GitHub Desktop.
Massive - Originally can grab provider name from connection object, if provided, with default set to System.Data.SqlClient. Removed in alpha branch?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
public DynamicModel(string connectionStringName, string tableName = "", | |
string primaryKeyField = "", string descriptorField = "") { | |
TableName = tableName == "" ? this.GetType().Name : tableName; | |
PrimaryKeyField = string.IsNullOrEmpty(primaryKeyField) ? "ID" : primaryKeyField; | |
DescriptorField = descriptorField; | |
var _providerName = "System.Data.SqlClient"; | |
// --->>> This is not present in alpha version - leaving for now: | |
if (!string.IsNullOrWhiteSpace(ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName)) | |
_providerName = ConfigurationManager.ConnectionStrings[connectionStringName].ProviderName; | |
_factory = DbProviderFactories.GetFactory(_providerName); | |
ConnectionString = ConfigurationManager.ConnectionStrings[connectionStringName].ConnectionString; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment