this question is about using https://github.com/maxtoroq/DbExtensions
DbConnection connection = Database.CreateConnection("name=myconx");
var query = SQL.SELECT("u.username").FROM("Users u").WHERE("Id={0}", 1);
IEnumerable<Users> products = connection.Map<Users>(query);
The following code is returning null don't know why ?
getDbProviderFactory(connection);
and here's the definition no idea about the next code purpose :
static readonly Func<DbConnection, DbProviderFactory> getDbProviderFactory =
(Func<DbConnection, DbProviderFactory>)Delegate.CreateDelegate(typeof(Func<DbConnection, DbProviderFactory>), typeof(DbConnection).GetProperty("DbProviderFactory", BindingFlags.Instance | BindingFlags.NonPublic).GetGetMethod(nonPublic: true));
and here's my connection string
<add name="myconx" connectionString="Provider=SQLOLEDB.1;Integrated Security=SSPI;Persist Security Info=False;User ID=ES;Initial Catalog=TestDB;Data Source=ITA-PC\SQLR2" providerName="System.Data.OleDb"/>
The issue is that OleDbConnection does not override the DbProviderFactory property , which is also an issue with OdbcConnection. I will report these as bugs.
If you have the source code you could try something like this: