Id Convention

Andrei 's Avatar

Andrei

27 Jul, 2010 09:09 AM via web

Hello, I have a question regarding conventions.
I want to be able to do something like this :

public class IdConvention : IIdConvention

{
    public void Apply(IIdentityInstance instance)
    {
        instance.GeneratedBy.Assigned()
    }
}

, and in the mapping class not to specify : Id(x=x.Id). But if I don't specify the mapping for Id the Fluent Nhibernate throws an exception saying the Id is not mapped.
I don't see the sense to map the Id because I have create a convention for it.
I'm doing something wrong or I'm missing something?
Thank you
Andrei

  1. Support Staff 2 Posted by Paul Batum on 07 Aug, 2010 12:32 AM

    Paul Batum's Avatar

    Currently, the only supported way for you to be able to avoid having to type
    "Id(x => x.Id)" is to use automapping. Automapping will reflect on your
    classes and build the mappings for you. Your convention will also be
    applied.

    I think James is doing some experimental work on bring fluent mapping and
    automapping closer together that could help in this scenario but I do not
    know how far along the work is.

    On Tue, Jul 27, 2010 at 7:11 PM, Andrei <
    tender+d708d292c54fba3b80ffb21d31aa7eb20cc9f540e@tenderapp.com<tender%2Bd708d292c54fba3b80ffb21d31aa7eb20cc9f540e@tenderapp.com>
    > wrote:

Reply to this discussion

Preview Comments are parsed with Markdown. Help with syntax

Attached Files

You can attach files up to 10MB

Ten divided by two is what?