How does Dapper create an instance of the correct command class in ADO.Net?

ado.net c# dapper sqlanywhere

Question

How does Dapper create a DbCommand-instance of the specific ADO.Net driver using the DbConnection instance?

For example if i use SAConnection, how does Dapper create an instance of SACommand when querying data?

Sample

using (iAnywhere.Data.SQLAnywhere.SAConnection connection = 
DAL.ConnectionManager
   .GetOpenPoolConnection<iAnywhere.Data.SQLAnywhere.SAConnection>())
{
    connection.Execute("INSERT INTO Table1 (FallbackLanguageID, Guid) 
                        VALUES (?, ?)", new { fallbackLanguageID, newLocalizationGroup });
}

Accepted Answer

Each specific DBConnection implements an IDBConnection interface, which has a CreateCommand method. Dapper just calls that.



Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why
Licensed under: CC-BY-SA with attribution
Not affiliated with Stack Overflow
Is this KB legal? Yes, learn why