Never mind. I've decided not to use natural id. Natural Id generates a
unique index on the table. A unique index on two or more columns can
be very expensive to build. Anyway, I am reconsidering my approach.

Daniel

On 28 Jan, 10:56, Daniel Lidström <[email protected]> wrote:
> Hello,
>
> I am not sure this question makes sense at all, but is it somehow
> possible to specify a component as natural id? Here's what I'm trying
> to do:
>
>         public class Position
>         {
>                 public long Empty { get; set; }
>
>                 public long Mover { get; set; }
>
>                 public override int GetHashCode() { ... }
>
>                 public override bool Equals(object obj) { ... }
>
>                 public class PositionMap : ComponentMap<Position>
>                 {
>                         public PositionMap()
>                         {
>                                 Map(x => x.Empty);
>                                 Map(x => x.Mover);
>                         }
>                 }
>         }
>
>         public class Board
>         {
>                 public virtual Guid Id { get; set; }
>
>                 public virtual Position Position { get; set; }
>
>                 public override bool Equals(object obj) { return
> Position.Equals(obj); }
>
>                 public override int GetHashCode() { return 
> Position.GetHashCode(); }
>
>                 public class Map : ClassMap<Board>
>                 {
>                         public Map()
>                         {
>                                 Id(x => x.Id);
>                                 Component(x => x.Position).NaturalId(); // 
> nice to have
>                         }
>                 }
>         }
>
> Is this possible at all? That is, specifying the parts of a component
> to be the natural id. Thanks in advance!
>
> Daniel

-- 
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.

Reply via email to