/// <summary> /// Probes the specified database. /// </summary> public DatabaseDialect Probe(DynamicDatabase database, string providerName, string connectionString) { switch (providerName) { case "System.Data.SqlClient": return(ProbeSqlServer(database)); case "System.Data.SqlServerCe.4.0": return(new SqlCompact4Dialect()); default: return(new DatabaseDialect()); } }
/// <summary> /// Probes the specified database. /// </summary> public DatabaseDialect Probe(DynamicDatabase database, string providerName, string connectionString) { switch (providerName) { case "System.Data.SqlClient": return ProbeSqlServer(database); case "System.Data.SqlServerCe.4.0": return new SqlCompact4Dialect(); default: return new DatabaseDialect(); } }
private static DatabaseDialect ProbeSqlServer(DynamicDatabase database) { string versionString; try { versionString = (string)database.Scalar(@"SELECT SERVERPROPERTY('productversion');"); } catch (SqlException) { versionString = "0"; } int version; if (Int32.TryParse(versionString.Split('.').First(), out version) && version > 0) { return new SqlServerDialect(version); } return null; }
private static DatabaseDialect ProbeSqlServer(DynamicDatabase database) { string versionString; try { versionString = (string)database.Scalar(@"SELECT SERVERPROPERTY('productversion');"); } catch (SqlException) { versionString = "0"; } int version; if (Int32.TryParse(versionString.Split('.').First(), out version) && version > 0) { return(new SqlServerDialect(version)); } return(null); }
public DatabaseDialect Probe(DynamicDatabase database, string providerName, string connectionString) { return this.dialect; }
/// <summary> /// Initializes a new instance of the <see cref="DynamicModel"/> class. /// </summary> /// <param name="database">The database.</param> /// <param name="tableName">Name of the table.</param> /// <param name="primaryKeyField">The primary key field.</param> public DynamicModel(DynamicDatabase database, string tableName = "", string primaryKeyField = "") { this.Database = database ?? new DynamicDatabase(); this.TableName = tableName == "" ? this.GetType().Name : tableName; this.PrimaryKeyField = string.IsNullOrWhiteSpace(primaryKeyField) ? "ID" : primaryKeyField; }
public DatabaseDialect Probe(DynamicDatabase database, string providerName, string connectionString) { return(this.dialect); }