No Steve... open your mind... this is not THAT place.
here the mix between "declarative" and "conventions"is natural and always
present.
Convention overrides is the norm.
Let me show you...
A user sent me its domain. his is one mapping
public class AppTenantMap : EntityMap<AppTenant>
{
public AppTenantMap()
{
Schema("[dbo]");
Table("[AppTenants]");
ManyToOne(x => x.App, map => map.Cascade(Cascade.All));
ManyToOne(x => x.Tenant, map => map.Cascade(Cascade.All));
}
}
All declarative and that Cascade.All everywhere in each ManyToOne... well he
can change it this way:
public class AppTenantMap : EntityMap<AppTenant>
{
public AppTenantMap()
{
Schema("[dbo]");
Table("[AppTenants]");
ManyToOne(x => x.App);
ManyToOne(x => x.Tenant);
}
}
and apply the Cascade.All convention in all manyToOne in this way:
var mapper = new ModelMapper();
mapper.BeforeMapManyToOne += (mi, pp, map)=> map.Cascade(Cascade.All);
mapper.AddMappings(typeof(User).Assembly.GetExportedTypes().Where(t =>
!t.IsGenericTypeDefinition));
On Wed, Apr 13, 2011 at 1:30 PM, Stephen Bohlen <[email protected]> wrote:
> So without any out-of-the-box conventions the primary use-case for this
> feature would be limited to declarative mapping in code (unless the user
> then authored their own conventions of course), is that right --? That
> seems a reasonable starting point for a first release but I think its
> valuable to provide usable out-of-the-box conventions to assist new adopters
> so I'd recommend that we try to ensure that some conventions make it into
> the very next release.
>
> Steve Bohlen
> [email protected]
> http://blog.unhandled-exceptions.com
> http://twitter.com/sbohlen
>
>
>
> On Wed, Apr 13, 2011 at 11:46 AM, Fabio Maulo <[email protected]>wrote:
>
>> To try to be more clear...
>> A convention is all ways opinable and we have enough work to do to
>> maintain even our conventions over the default-NH-conventions (property-name
>> = columnName for example).
>>
>> Perhaps we may includes some default-conventions later (for example
>> many-to-many table = RoleToUser).
>> Thoughts ?
>>
>>
>> On Wed, Apr 13, 2011 at 12:37 PM, Fabio Maulo <[email protected]>wrote:
>>
>>> Hi all.
>>> I'm implementing ConventionModelMapper but I'm a little bit boring
>>> basically because I'm re-implementing re-testing someones of ConfORM
>>> patterns-appliers.
>>>
>>> Do you mind if we release NH3.2 with the ability to implement a
>>> Convention based mapping but without provide real conventions ?
>>>
>>> --
>>> Fabio Maulo
>>>
>>>
>>
>>
>> --
>> Fabio Maulo
>>
>>
>
--
Fabio Maulo