This is my fault, the unique attribute isn't available for components on
NHibernate 2.0, it's only available in trunk. I've mistakenly added support
for this attribute.

On Sun, Feb 1, 2009 at 7:43 PM, m4bwav <[email protected]> wrote:

>
> Oh yeah here's ClassMapWithGenerator
> public class ClassMapWithGenerator<T> : ClassMap<T>, IMapGenerator
>    {
>        #region IMapGenerator Members
>
>
>
>        public System.Xml.XmlDocument Generate()
>        {
>            return CreateMapping(new MappingVisitor());
>        }
>
>        #endregion
>    }
>
> and SpaceLocation:
>
> public class SpaceLocation
>    {
>        public virtual Guid Id { get; set; }
>        public virtual SpaceCoordinate Coordinates { get; set; }
>        public virtual SpaceObject AtLocation { get; set; }
>     }
>
> On Feb 1, 1:42 pm, m4bwav <[email protected]> wrote:
> > I tried to use the unique constraint for a component, so that all of
> > the members of a component together make up a single unique
> > constraint.
> >
> >  public class SpaceLocationMap : ClassMapWithGenerator<SpaceLocation>
> >     {
> >         public SpaceLocationMap()
> >         {
> >             Id(x => x.Id);
> >             References(x => x.AtLocation);
> >             Component<SpaceCoordinate>(x => x.Coordinates, m =>
> >             {
> >                 m.Map(x => x.x);
> >                 m.Map(x => x.y);
> >                 m.Map(x => x.z);
> >             }).Unique();
> >         }
> >     }
> >
> > But when I call this sequence to hook up the mapping files
> >
> > var persistentModel = new PersistenceModel();
> > persistentModel.addMappingsFromAssembly(typeof
> > (GameNHibernateSession).Assembly);
> > Storage = storage;
> > _Source = new SessionSource(properties, persistentModel);
> >
> > I get the following error:
> >
> > TestCase 'StarCurrents.IntegrationTests.GameSetupTests.SetupGameTest'
> > failed: System.ApplicationException : Error while trying to build the
> > Mapping Document for
> > 'StarCurrents.Domain.Reality.BaseObjects.SpaceLocation'
> >   ----> NHibernate.MappingException : (XmlDocument)(7,63): XML
> > validation error: The 'unique' attribute is not declared.
> >   ----> System.Xml.Schema.XmlSchemaValidationException : The 'unique'
> > attribute is not declared.
> >         C:\Users\Mark\Documents\Visual Studio
> 2008\Projects\fluent-nhibernate
> > \src\FluentNHibernate\Mapping\ClassMap.cs(168,0): at
> > FluentNHibernate.Mapping.ClassMap`1.ApplyMappings(IMappingVisitor
> > visitor)
> > ..etc
> >
> > Is this a bug, or am I doing something wrong?
> >
>

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