Fluent NHibernate模型引用属性映射模型

时间:2015-12-10 15:37:10

标签: c# nhibernate fluent-nhibernate hbm

我有这个型号:

public class Job
    {
        public virtual Guid Id { get; set; }
        public virtual Employee Emp { get; set; }
        public virtual DateTime? StartDateJob{ get; set; }
        public virtual DateTime? EndDateJob{ get; set; }
    }

使用Fluent Nhibernate映射:

public class JobMap: ClassMap<Job>
    {
        public JobMap()
        {
            Table("Jobs");

            Id(x => x.Id).GeneratedBy.GuidNative();

            Map(x => x.StartDateJob);
            Map(x => x.EndDateJob);

            References(x => x.Emp , "EmpId");
        }
    }

我的问题是Employee类是一个使用属性

映射的实体
[Class(NameType = typeof(Employee ), Table = "emp")]
    public class Employee
    {
        [Property(TypeType = typeof (DateTime), NotNull = false)]
        public virtual DateTime? X { get; set; }

        [Property(TypeType = typeof (DateTime), NotNull = false)]
        public virtual DateTime? Y{ get; set; }
    }

错误表明Job有一个未映射类的引用。有一种方法可以使用属性映射模型作为对流畅映射模型的引用吗?

谢谢!

0 个答案:

没有答案