Hi,

Ok, perhaps I worded my question incorrectly:
I have a class who's mapping has a primary key comprising of two integers.
Is it possible to get these column names with this solution?
Cheers
Sean.

From: [email protected] [mailto:[email protected]] On Behalf Of 
Ricardo Peres
Sent: 28 May 2013 16:09
To: [email protected]
Subject: [nhusers] Re: obtaining the names of the composite primary keys 
properties

This will give you the physical column names. An entity in NHibernate will only 
have, at most, a single identifier property.

String entityName = (sessionFactory as 
ISessionFactoryImplementor).TryGetGuessEntityName(entityType);
AbstractEntityPersister persister = (sessionFactory as 
ISessionFactoryImplementor).TryGetEntityPersister(entityName) as 
AbstractEntityPersister;

if (persister != null)
{
            return (persister.IdentifierColumnNames);
}

RP

On Tuesday, May 28, 2013 3:48:18 PM UTC+1, Sean Farrow wrote:
Hi,

I've obtained the class meta data from the session factory. What I'm now after 
is the number and names of the primary key properties whether this be composite 
keys or otherwise.
I can see a GetIdentifier method and others referring to natural id's can 
someone give me some pointers please!
Cheers
Sean.
--
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to 
[email protected]<mailto:[email protected]>.
To post to this group, send email to 
[email protected]<mailto:[email protected]>.
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


-- 
You received this message because you are subscribed to the Google Groups 
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to [email protected].
To post to this group, send email to [email protected].
Visit this group at http://groups.google.com/group/nhusers?hl=en-US.
For more options, visit https://groups.google.com/groups/opt_out.


Reply via email to