I do.
Class:
public class Contributor
{
#region Properties
public virtual int Id { get; set; }
public virtual string SequenceNumber { get; set; }
public virtual IList<string> Names { get; set; }
#endregion
#region Constructor
public Contributor()
{
this.SequenceNumber = String.Empty;
this.Names = new List<string>();
}
#endregion
}
Mapping:
using FluentNHibernate.Mapping;
public class ContributorMap : ClassMap<Contributor>
{
public ContributorMap()
{
Id(x => x.Id);
Map(x => x.SequenceNumber);
HasMany(x => x.Names).AsElement("MyNames"); //WithElement can
not be found.
}
}
From: [email protected]
[mailto:[email protected]] On Behalf Of James Gregory
Sent: Montag, 16. Februar 2009 10:09
To: [email protected]
Subject: [fluent-nhib] Re: Mapping simple datatypes via fluent nhibernate
Well, that code you gave is correct. Did you say you were mapping a
List<string>? Have you tried an IList<string>?
On Mon, Feb 16, 2009 at 8:20 AM, Tom Warnat <[email protected]> wrote:
Hi,
the WithElement-Option ist not valid.
HasMany(x => x. MyListOfStrings).AsElement("foo") would be my only option.
I get a MySql.Data.MySqlClient.MySqlException: Table 'foo' doesn't exist
while running this piece of code.
-----Original Message-----
From: [email protected]
[mailto:[email protected]] On Behalf Of James Gregory
Sent: Montag, 9. Februar 2009 14:13
To: [email protected]
Subject: [fluent-nhib] Re: Mapping simple datatypes via fluent nhibernate
HasMany(x => x.MyListOfStrings)
.WithElement("string column name")
This is from memory so it may not be exact.
On 2/9/09, Tom Warnat <[email protected]> wrote:
>
> Hi,
>
> i've tryed to map a list of string via fluent nhibernate lately and i
> can't get it to run.
>
> So googling for 8 hours on friday i'll take my shoot here.
>
> Can anyone tell me to map a simply a List<string>? Furthermore how get
> fluent nhibernate to automatically create the relation for the list
> (which is basically my problem)?
>
> thanks in advance.
>
> >
>
--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected]
To unsubscribe from this group, send email to
[email protected]
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---