次のコードがあります。
private static ISessionFactory CreateSessionFactory()
{
ISessionFactory factory = null;
var cfg = new Configuration();
// Do this to map bool true/false to DB2 char('0') or char('1')
var props = new Dictionary<string, string>();
props.Add("query.substitutions","true=1;false=0");
cfg.AddProperties(props);
cfg.DataBaseIntegration(x =>
{
x.ConnectionString = CONNECTION_STRING;
x.Dialect<DB2400Dialect>();
x.Driver<DB2400Driver>();
});
factory = Fluently.Configure(cfg)
.Mappings(m => m.FluentMappings.AddFromAssembly(Assembly.GetExecutingAssembly()))
.BuildSessionFactory();
return factory;
}
私のPOCOには、次のプロパティがあります。
public virtual bool QCCount { get; set; }
私のマッピングでは、
Map(x => x.QCCount, "QCNT36");
DB2 には、ビット フィールドはなく、'0' または '1' を持つ char(1) だけです。
私が理解しているように、props.Add("query.substitutions","true=1;false=0"); これらの 0 と 1 をブール値の POCO オブジェクトにマップする必要がありますが、機能していないようです。
これを使用するようにフィールドのマッピングに何かを追加する必要がありますか?