1

I'm working with a codebase that has the equivalent to the following:

public class CustomList<T> : List<T>

And then in a subsequent Class

public interface ISomeObject {
    string Name { get; set; }
    CustomList<ISomeOtherObject> SomeOtherObjects { get; set; }
}

Now in the Mapping file for a normal List the xml would be (I've checked this works):

<list name="SomeOtherObjects " table="SomeOtherObject">
    <key column="Id"/>
    <index column="Reference"/>
    <composite-element class="SomeOtherObject" />
</list>

I need to find out what the equivalent xml is for the CustomList. I've googled and searched here until I am blue in the face finding bits and pieces about components and how to map custom collections but so far I've not been able to find enough to get me over this hurdle. I am trialing and erroring like mad with all the different properties so if anyone has a snippet example of how to map a custom list I'd be very greatful.

Cheers.

1 Answer 1

1

Your mapping is on the right path, but incomplete. It should look something like this.

<list name="SomeOtherObjects " table="SomeOtherObject">
    <key column="Id"/>
    <index column="Reference"/>
    <composite-element class="SomeOtherObject" >
        <property name="SomeOtherObjectProperty" />
        <!-- More properties that are defined in SomeOtherObject here. -->
    </composite-element>
</list>

This post may help you understand more about collection mapping.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks! I'll take a look. Post is over a year old but I appreciate it when someone eventually replies.
@David I did notice how old this question was, but as you mentioned, its nice to have at least one answer.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.