Yes, there are lots of mapping options still missing from code mapping. You 
can add a request for this on JIRA (https://nhibernate.jira.com), but, in 
the meantime, you can achieve what you want with this code:

cfg.GetCollectionMapping(typeof(Scope).FullName + ".Organizations").OrderBy = 
"name";


This must be done before building the session factory.

RP


On Tuesday, June 4, 2013 6:21:19 PM UTC+1, RyanH wrote:
>
> I'm trying to specify a database performed Order-By on a many-to-many set 
> as described at the top of this blog post:  
> http://nealblomfield.wordpress.com/2009/02/03/nhibernate-many-to-many-mappings-and-order-by/
>
> However, I'm not able to set the order-by attribute on the many-to-many 
> tag from mapping by code.  The code below is how I believe that it *should* 
> look, however the map.OrderBy function is not present.  Should this be 
> submitted as a bug, or is there another way to set that attribute?
>
> public class ScopeMap : ClassMapping<Scope>
>     {
>         public ScopeMap()
>         {
>             Id(x => x.Id, id => id.Generator(Generators.Identity));
>
>             Property(x => x.Name);
>
>             Set(x => x.Organizations, set =>
>                 {
>                     set.Key(key =>
>                         {
>                             key.NotNullable(true);
>                             key.Update(false);
>                         });
>                     set.Inverse(false);
>                 }
>                 ,relation => relation.ManyToMany(map => map.OrderBy(x => 
> x.Name)));  // OrderBy function is missing
>         }
>

-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to