English 中文(简体)
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.





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签