What you need to do is create a new class for the convention and
implement IReferenceConvention.

Like:

public class ReferenceConvention : IReferenceConvention
{
    public bool Accept(IManyToOnePart part)
    {
        return true;
    }

    public void Apply(IManyToOnePart part)
    {
        part.ColumnName("ID" + part.EntityType.Name);
    }
}

The wiki page on conventions has plenty of examples:
http://wiki.fluentnhibernate.org/show/AutoMappingConventions

On May 6, 1:28 pm, Jose Selesan <jsele...@gmail.com> wrote:
> Hi there. It's a simply question. I have this class:
>
> public class Course
> {
>    public virtual int Id { get; set; }
>    public virtual string Name{ get; set; }
>    public virtual Teacher TeachedBy{ get; set; }
>
> }
>
> I'm using AutoPersistenceModel to map my entities and for the previous
> class, the many-to-one element in hbm.xml is like that:
> <many-to-one name="TeachedBy" column="*Teacher_id*" />
>
> But I want to get this:
> <many-to-one name="TeachedBy" column="*IDTeacher*" />
>
> So, my question is, what Convention do I need in order to get what I want?
>
> Thanks
--~--~---------~--~----~------------~-------~--~----~
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