В новом проекте появилось ограничение - все запросы к БД должны выполняться через специальный компонент "MySuperDbConnection". В компоненте реализован набор методов ExecuteScalar(DbCommand), ExecuteReader(DbCommand) и пр. Целевая БД - postgres.
Можно ли как то попросить linq2db выполнять все запросы через этот компонент?
Цель - использовать всю мощь linq2db для формирования статически типизованных запросов, а выполнять их через свою библиотеку.
You should loot at DataConnection constructors that accept IDbConnection/Func<IDbConnection>. There you need to pass your MySuperDbConnection or adapter to MySuperDbConnection.
Also disable use of npgsql-specific API: https://github.com/linq2db/linq2db/blob/master/Source/LinqToDB/Common/Configuration.cs
Note that because execute methods belong to DbCommand, you will need to implement own DbCommand and return it from custom connection.
@SergeyA, also we have global interceptor. Maybe it can help
You can inject here:
https://github.com/linq2db/linq2db/blob/master/Source/LinqToDB/Data/DbCommandProcessor/DbCommandProcessorExtensions.cs#L22
Implement IDbCommandProcessor and assign this static property.
@SergeyA please use English if possible when publishing an issue. Thank you!
Most helpful comment
@SergeyA, also we have global interceptor. Maybe it can help
You can inject here:
https://github.com/linq2db/linq2db/blob/master/Source/LinqToDB/Data/DbCommandProcessor/DbCommandProcessorExtensions.cs#L22
Implement IDbCommandProcessor and assign this static property.