Off the top of my head, I don't think we can de-generic those classes. We
need the generic type definitions to create the Expression<T> parameters.
I'm so out of the loop, but couldn't you have it where the onetomany
convention gets registered into a list that all onetomany's use when writing
their output, rather than just ones for that exact type?
I need to spend some time getting my head around what you've been doing with
this automapping/conventions stuff.

On Fri, Sep 12, 2008 at 11:16 AM, Andrew Stewart <
[EMAIL PROTECTED]> wrote:

> Hi
> I'm just looking over our convention logic. What I'd like to be able to do
> is specify that certain things happen in all my maps, at the moment I have
> the following working:
>
> AutoPersistenceModel
>    .MapEntitiesFromAssemblyOf<Company>()
>    .Where(  t => (t.Namespace.Contains("NamespaceName")
>    .ForTypesThatDeriveFrom<Task>( map => map.HasManyToMany<User>( t =>
> t.Users ) )
>    .ForTypesThatDeriveFrom<Plot>( map => map.HasManyToMany<Service>( t =>
> t.Services ) )
>    .WithConvention( c => c.OneToManyConvention = m =>
>                                                                   {
>
>  m.SetAttribute("cascade", "all");
>
>  m.SetAttribute("lazy", "true");
>                                                                   })
>    .Configure( configuration );
>
> As you can see the bit in bold isn't nice at all. But it does work. What
> I'd like to achieve and I'm sure the syntax could be improved slightly is
> something more like the below:
>
> AutoPersistenceModel
>    .MapEntitiesFromAssemblyOf<Company>()
>    .Where(  t => (t.Namespace.Contains("NamespaceName")
>    .ForTypesThatDeriveFrom<Task>( map => map.HasManyToMany<User>( t =>
> t.Users ) )
>    .ForTypesThatDeriveFrom<Plot>( map => map.HasManyToMany<Service>( t =>
> t.Services ) )
>    .WithConvention( c => c.OneToManyConvention = m =>
>                                                                   {
>
>  m.Cascade.All();
>
>  m.LazyLoad();
>                                                                   })
>    .Configure( configuration );
>
> Now here's my problem at the moment Generic Types.
>
> Essentially the OneToMany is generic and I want to apply these to all
> different types of entity maps, has anyone got a good idea on how to make
> these none generic-able?
>
> Maybe someone has some preset idea's on how this should be implemented who
> can just overirde this entire conversation, and I'll just head down that
> route instead.
>
> Cheers
>
> Andy
>
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Fluent NHibernate" group.
To post to this group, send email to fluent-nhibernate@googlegroups.com
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