I am dealing with a legacy database, and we have a field which doesn't make sense anymore, but I would rather not change the DB schema.
I'm trying to map an old DB text field into a class with a boolean (only need to know about one option that the DB text field has). I can get the boolean value out of the DB using Forumla, but I can seem to get it to save any updates back into the DB.
My class and current fluent mapping for it is:
public class Bulletin
{
public virtual int Id { get; set;}
public virtual bool RegularBulletin { get; set;}
}
public class BulletinMapping : ClassMap<Bulletin>
{
public BulletinMapping()
{
Table("Bulletins");
Id(x => x.Id, "ID").GeneratedBy.Identity();
Map(x => x.RegularBulletin)
.Formula("case when EmailType = 'BULLETIN_B' then 1 else null end")
.Nullable();
}
}
Does anyone have any ideas about how to persist the RegularBulletin field?
Thanks Saan