Hi, I'm new in nhibernate and I need help.
I have:
Code:
public abstract class AreaBase : BusinessEntity
{
public virtual string FirstName { get; set; }
public virtual string LastName { get; set; }
}
public class OArea : AreaBase
{
public virtual Regions Region { get; set; }
}
public class Regions : List<RegionsArea>
{
}
public class RegionsArea : AreaBase
{
public virtual Country Country { get; set; }
}
table:
Code:
CREATE TABLE [dbo].[tArea]
(
[Id] [dbo].[ID] IDENTITY(1, 1) NOT NULL PRIMARY KEY,
[FirstName] varchar(50) NOT NULL,
[LastName] varchar(50) NOT NULL,
[ParentId] [dbo].[ID] NULL,
CONSTRAINT [FK_tArea_tArea] FOREIGN KEY ([ParentId]) REFERENCES [tArea]([Id])
)
I wrote:
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping assembly="Entities" namespace="Entities.Profiles" xmlns="urn:nhibernate-mapping-2.2">
<class name="AreaBase" table="tArea">
<id name="Id">
<column name="Id" sql-type="bigint"/>
<generator class="native"/>
</id>
<property name="FirstName" column="FirstName"/>
<property name="LastName" column="LastName"/>
</class>
</hibernate-mapping>
but don't no idea have to mapping ParentId from OArea:AreaBase. (Region RegionsArea)
Please help!!!