Ok I did remove that class attribute - I shouldn't have pasted that in the code sample - it was something I had just tried (trial and error trying to get it to work).
The reason types were on the Task only was because I wanted to just try using them explicitly to see what kind of behavior I would see.
These are my BL classes - maybe you'll find something in here that might spark something?
Task Object
Code:
public class Task : ITask
{
public Task() { }
public Task(string taskName)
{
Name = taskName;
CreateDate = DateTime.Now;
}
public int Id { get; set; }
public string Name { get; set; }
public string Description { get; set; }
public DateTime CreateDate { get; set; }
public DateTime ModifiedDate { get; set; }
public IUser User { get; set; }
public override string ToString()
{
return Name;
}
}
User object
Code:
public class User : IUser
{
public List<Task> Tasks { get; set; }
public int Id { get; set; }
public string FirstName { get; set; }
public string LastName { get; set; }
public string Email { get; set; }
public string Password { get; set; }
public DateTime CreateDate { get; set; }
public void AddTask(Task t)
{
if (Tasks == null)
Tasks = new List<Task>();
t.User = this;
Tasks.Add(t);
}
public override string ToString()
{
return FirstName + " " + LastName;
}
}
I get the same error as in my previous post. If I change the type in the Task class from User to IUser I get this error:
Code:
The type initializer for 'SwiftToDo.DL.NHDataProvider' threw an exception.
----> NHibernate.MappingException : An association from the table tblTask refers to an unmapped class: SwiftToDo.BL.IUser
Hopefully something jumps out at you ?