Could you use different ClassMap classes for each config? You would probably have to explicitly add each ClassMap to your Fluent session configuration, which would make it more verbose, but it would mean you can use a different mapping class for the different databases.
public class BinaryFileMSSqlServer
{
public BinaryFile()
{
m.Map(x => x.BinaryData).CustomSqlType("varbinary(MAX)");
m.Map(x => x.ContentType);
m.Map(x => x.FileName);
m.Map(x => x.FileSize);
}
}
public class BinaryFileSQLite
{
public BinaryFile()
{
m.Map(x => x.BinaryData);
m.Map(x => x.ContentType);
m.Map(x => x.FileName);
m.Map(x => x.FileSize);
}
}
Your fluent session mapping would then look something like this:
Fluently.Configure()
.Database(MsSqlConfiguration.MsSql2005
.ConnectionString(c => c
.FromAppSetting("connectionString"))
.Cache(c => c
.UseQueryCache()
.ProviderClass<HashtableCacheProvider>())
.ShowSql())
.Mappings(m => m.FluentMappings
.Add<BinaryFileMSSqlServer>()
.Add<...>()
.Add<...>())
.BuildSessionFactory();
You would need to fill in each of your mapping classes manually. You would also need to create a separate fluent configuration for SQLite, using the SQLite specific ClassMaps where necessary.