we are using petapoco mini ORM which have inline queries use to connect to PostgreSQL database.
public async Task<IEnumerable<P>> FetchExistP(CQ c)
{
var query = "select * from \"P\"where \"Pr\"= " + c.M;
var database = BuildDatabase(c.DatabaseId.ToString(CultureInfo.InvariantCulture));
return await database.FetchAsync<P>(query);
}
Now we want to support SQLserver database as well.Since queries in PostgreSQl uses double quote hence we need to modify syntax for every query what should we do for this.
should we use factory design pattern or some other design pattern and create duplicate repository class files for SQL version ?
do we have any utility which takes query and based on database converts syntax accordingly ?
- Any other option ?