Hey Seb,

> IUserType convention. I wrote something that does convention =>
> convention.AddUserType<UriType>() to automatically inject the user type in
> any reference to Uri.
>

I think our support for IUserType needs some loving; however, I believe you
can do it by using a ITypeConvention.

  .WithConvention(c => c.AddTypeConvention(new UriConvention()));

public class UriConvention : ITypeConvention
{
  public bool CanHandle(Type type)
  {
    return type is Uri;
  }

  public void AlterMap(IProperty property)
  {
    property.SetAttribute("type",
typeof(UriUserType).AssemblyQualifiedName);
  }
}

That's from memory, so excuse any typo's.

Lazy loading convention. The entities that can be retrieved through my
> repository implement IRootAggregate. I'd like a convention to automatically
> set lazy loading on any property linking to IRootAggregate.


As for this one, I think you could probably also solve that through a
ITypeConvention. Something like this maybe:

public class RootAggregateConvention : ITypeConvention
{
  public bool CanHandle(Type type)
  {
    return type.IsAssignableFrom(typeof(IRootAggregate));
  }

  public void AlterMap(IProperty property)
  {
    property.SetAttribute("lazy", "true");
  }
}

Hope that's of some help. We definitely need to look at this area though.
Contributions are always welcome :)

James

On Tue, Jan 6, 2009 at 7:56 PM, Sebastien Lambla <s...@serialseb.com> wrote:

>  Hi guys,
>
>
>
> I was trolling around the code base but couldn't find those two conventions
> I need. Any pointer to where they may be if they exist more than welcome.
> Otherwise, expect a patch soon.
>
>
>
> -          IUserType convention. I wrote something that does convention =>
> convention.AddUserType<UriType>() to automatically inject the user type in
> any reference to Uri.
>
> -          Lazy loading convention. The entities that can be retrieved
> through my repository implement IRootAggregate. I'd like a convention to
> automatically set lazy loading on any property linking to IRootAggregate.
> Not wrote any code for it yet, but would be happy to contribute.
>
>
>
> Comments / suggestions welcome :)
>
>
>
> Seb
>
> >
>

--~--~---------~--~----~------------~-------~--~----~
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 
fluent-nhibernate+unsubscr...@googlegroups.com
For more options, visit this group at 
http://groups.google.com/group/fluent-nhibernate?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to