문제

How do I map (using xml-based approach) a value object (component) which contains ISet<String> property?

[Serializable]
public class Contact
{
    public ISet<String> PhoneNumbers { get; set; }
    public String Email { get; set; }       
}

Thanks!

도움이 되었습니까?

해결책

Use element.

<set name="PhoneNumbers" table="phone_numbers">
    <key column="contact_id">
    <element column="phone_number" type="String"/>
</set>

If you're going to use PhoneNumbers property just for displaying purpose, consider "cheaper" approach with serializing the data, without separate table and separate query to fetch the collection.

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top