开发者

What is the Fluent NHibernate Convention for value object list

I'm trying to figure out what the convention would be for a value object list, in this case an IList. Here a code fragment for my domain model:

public class RegionSetting : Entity {
    public virtual bool Required { get; set; }
    public virtual string Name { get; 开发者_开发知识库set; }
    public virtual IList<string> Options { get; set; }
}

My automapping is set to:

public class RegionSettingMap : IAutoMappingOverride<RegionSetting> {
    public void Override(AutoMapping<RegionSetting> mapping) {
        mapping
            .HasMany(x => x.Options).Element("Options")
            .Table("RegionSettingOptions")
            .KeyColumn("RegionSettingId");
    }
}

I'd like to make the .Table() and .KeyColumn() overrides into a convention so that I don't have to do that everywhere I'm using IList<string>. I thought that I could create an IHasManyConvention, but it doesn't seem to affect this mapping. I set a breakpoint in my custom HasManyConvention class, but it doesn't break for the Options property. Could anyone tell me what convention I should be using to automate this override?


Using an IHasManyConvention should've worked. Try an IBagConvention, see if that works. If not, there's a bug in there.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜