I'm not sure if I follow the code you provided. It looks like you are
defining a convention, but then you have virtual members that look like they
should be part of your domain object, not your convention definition.
In any case, assuming that you have a class that looks like this:
public class TestClass
{
public virtual string TypeID { get; set; }
public virtual int TypeName { get; set; }
}
And you actually have several classes that have a similarly named primary
key, and you want to automap them, you can use a convention to tell FNH what
the primary key is called. See the conventions page on the wiki:
http://wiki.fluentnhibernate.org/Conventions
<http://wiki.fluentnhibernate.org/Conventions>In particular, the convention
you are looking for is
PrimaryKey.Name.Is(x => "TypeID")
On Tue, Apr 13, 2010 at 6:40 PM, Peter Larsen [CPH] <[email protected]>wrote:
> Hi,
>
> I have a automapping class mapped to a table where the ID field is
> named TYPEID.
>
> public class TestClass : IClassConvention
> {
> public virtual void Apply(IClassInstance instance)
> {
> instance.Schema("schemaName");
> }
>
> public virtual string TypeID { get; set; }
> public virtual int TypeName { get; set; }
> }
>
> Since NHibernate must have an ID field, it is necessary to map field
> TypeID to NHibernates ID field.
> How do i do that ?
>
> Thank you in advance.
> /Peter
>
> --
> You received this message because you are subscribed to the Google Groups
> "Fluent NHibernate" group.
> To post to this group, send email to [email protected].
> To unsubscribe from this group, send email to
> [email protected]<fluent-nhibernate%[email protected]>
> .
> For more options, visit this group at
> http://groups.google.com/group/fluent-nhibernate?hl=en.
>
>
--
You received this message because you are subscribed to the Google Groups
"Fluent NHibernate" group.
To post to this group, send email to [email protected].
To unsubscribe from this group, send email to
[email protected].
For more options, visit this group at
http://groups.google.com/group/fluent-nhibernate?hl=en.