I am using nhibernate. My code is as below
public class Store
{
public virtual int Id { get; protected set; }
public virtual string Name { get; set; }
public virtual IList<Employee> Staff { get; set; }
public Store()
{
Staff = new List<Employee>();
}
}
Employee class
public class Employee
{
public virtual int Id { get; protected set; }
public virtual string FirstName { get; set; }
public virtual string LastName { get; set; }
public virtual Store Store { get; set; }
}
storemap
public class StoreMap:ClassMap<Store>
{
public StoreMap()
{
Id(x => x.Id);
Map(x => x.Name);
HasMany(x => x.Staff).WithKeyColumn("store");
}
}
employeemap
public EmployeeMap ()
{
Id(x => x.Id);
Map(x => x.FirstName);
Map(x => x.LastName);
References(x => x.Store ).WithColumns("store");
}
this is working fine. but i want one to one relation between employee and store and for that i try this but this doesn't work. in employeemap References(x => x.Store).WithForeignKey("store"); and in stormap
HasOne(x => x.Staff).WithForeignKey("store");
but this result in following error
persistent class not known:
System.Collections.Generic.IList`1[[test.Models.Employee, test,
Version=1.0.0.0, Culture=neutral, PublicKeyToken=null]]
Please help