[fluent-nhib] Re: Upgraded to Fluent nHibernate 1.2.0.694 and new Generate() method doesn't work.

2011-04-04 Thread Jack
I'm using Sharp Architecture and that is how the Northwind sample they
have implemented it.

Previously it was this:
/// 
/// Provides a filter for only including types which inherit
from the IEntityWithTypedId interface.
/// 

private bool GetAutoMappingFilter(Type t)
{
return t.GetInterfaces().Any(x =>
 x.IsGenericType &&
 x.GetGenericTypeDefinition()
== typeof(IEntityWithTypedId<>));
}

public AutoPersistenceModel Generate()
{
var mappings = new AutoPersistenceModel();
 
mappings.AddEntityAssembly(typeof(Class1).Assembly).Where(GetAutoMappingFilter);
mappings.Conventions.Setup(GetConventions());
mappings.Setup(GetSetup());
mappings.IgnoreBase();
mappings.IncludeBase(typeof(Asset));
mappings.IgnoreBase(typeof(EntityWithTypedId<>));
 
mappings.UseOverridesFromAssemblyOf();

return mappings;

}

 private Action GetSetup()
{
return c =>
{
c.FindIdentity = type => type.Name == "Id";
};
}
I reverted back to the original code, which is using deprecated
interfaces, for now.

On Apr 3, 1:33 am, James Gregory  wrote:
> public override bool ShouldMap(System.Type type)
>         {
>             return type.GetInterfaces().Any(x =>
>                  x.IsGenericType && x.GetGenericTypeDefinition() ==
> typeof(IEntityWithTypedId<>));
>         }
>
> This doesn't look right to me, what are you trying to do?

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



[fluent-nhib] Re: Upgraded to Fluent nHibernate 1.2.0.694 and new Generate() method doesn't work.

2011-04-03 Thread James Gregory
public override bool ShouldMap(System.Type type) 
{ 
return type.GetInterfaces().Any(x => 
 x.IsGenericType && x.GetGenericTypeDefinition() == 
typeof(IEntityWithTypedId<>)); 
} 

This doesn't look right to me, what are you trying to do?

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