I’ve noticed that the default_schema setting only works for generated
SQL.
user-provided SQL (in my case: via Map().Formula()) seems unaffected
by the default_schema setting.
Is there any way around this?
I’ve tried the naive approach by trying to read the default_schema
from the configuration in the mapping-class and then changing the SQL
in the .Formula() call to include the default_schema, but even
accessing the configuration from the mapping-file seems non-trivial.
Any help would be greatly appreciated!
Regards,
ldx
I solved this myself.
Since it seems impossible to access any configuration in the ClassMap (and I didn’t want to start reading config files manually there) and since you can’t have dependencies injected in the ClassMap via some IoC framework (Classmaps need a parameterless constructor),
I had to do it the “old fashioned way” with a singleton class:
The singleton:
public class DefaultSchemaProvider
{
private static DefaultSchemaProvider _instance = null;
private string _defaultSchema = null;
}
During configuration:
in the classmap: