i am trying to make a one-to-many relation (one way that is inverse="false")
heres the mapping file
Code:
<?xml version="1.0" encoding="utf-8" ?>
<hibernate-mapping xmlns="urn:nhibernate-mapping-2.2" namespace="Jinnah.ObjectPersistanceLayer" assembly="Jinnah.OPL">
<class name="Course_Info" table="Course_Info">
<id name="CourseId" column="Course_Id" type="int">
<generator class="identity"></generator>
</id>
<property name="CourseTitle" column="Course_Title" type="String"/>
<property name="CourseCode" column="Course_Code" type="String"/>
<property name="CourseDept" column="Course_Dept" type="String"/>
<property name="DateOfEntry" column="Date_Of_Entry" type="String"/>
<property name="UpdatedOnDate" column="Updated_On_Date" type="String"/>
<bag name="TPF_Course_Property" Inverse="false" cascade="all-delete-orphan">
<key column="Fk_Course_Id" type="int" length="4" not-null="false" />
<one-to-many class="Jinnah.ObjectPersistanceLayer.Classes.TPF_Teacher_Performance,Jinnah.OPL" />
</bag>
</class>
</hibernate-mapping>
here is the POCO class
Code:
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
namespace Jinnah.ObjectPersistanceLayer.Classes
{
public class Course_Info
{
private int _CourseId;
private string _Course_Title;
private string _CourseCode;
private string _CourseDept;
private string _DateOfEntry;
private string _UpdatedOnDate;
public virtual int CourseId
{
get { return _CourseId; }
set { _CourseId = value; }
}
public virtual string Course_Title
{
get { return _Course_Title; }
set { _Course_Title = value; }
}
public virtual string CourseCode
{
get { return _CourseCode; }
set { _CourseCode = value; }
}
public virtual string CourseDept
{
get { return _CourseDept; }
set { _CourseDept = value; }
}
public virtual string DateOfEntry
{
get { return _DateOfEntry; }
set { _DateOfEntry = value; }
}
public virtual string UpdatedOnDate
{
get { return _UpdatedOnDate; }
set { _UpdatedOnDate = value; }
}
private IList<TPF_Teacher_Performance> _TPF_Course;
public virtual IList<TPF_Teacher_Performance> TPF_Course_Property
{
get { return _TPF_Course; }
set { _TPF_Course = value; }
}
public Course_Info()
{
}
}
}
when is run this by calling a method , in the .aspx page it gives
The 'Inverse' attribute is not declared.
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: System.Xml.Schema.XmlSchemaValidationException: The 'Inverse' attribute is not declared.