I have the following class:
Code:
public class TimeCard
{
public long ID { get... set... }
public string WorkDescription {...}
public IProject Project {...}
public IEmployee Employee {...}
public DateTime InTime {...}
public DateTime OutTime {...}
}
public interface IProject
{
long ID{ get; }
}
public interface IEmployee
{
long ID{ get; }
}
The idea here is to persist the TimeCard class in one table, and also persist the IProject/IEmployee interfaces in the same table (I guess by using <component>in the mapping), by accessing their respective ID properties and saving them into the TimeCard table.
How would I set up the mapping for this? I dont need to persist the actual implementation of the IEmployee interfaces, just the ID reference in the TimeCard table.
I tried setting it up by just mapping the timecard class, and with <component> sections for each of the interfaces, but it throws an error saying "Could not load type IProject from assembly NHibernate".
One obvious problem seems to be loading the TimeCard object with the Employee/Project properties, since Hibernate only has an Interface as a reference, but no "real" object to put the values in (unless its able to use reflection to construct and serve up the appropriate "dummy" objects).
Anyways.. thankful for suggestions/answers..
// Christian