1
Fluent NHibernate를 사용하여 프로젝트 작업을 시작했습니다.구성 요소를 사용하는 Fluent NHibernate 매핑
Fluent NHibernate를 사용하여 다음 클래스를 매핑하는 올바른 방법은 무엇입니까?
public class DurationUnit
{
public virtual int Id { get; set; }
public virtual string Name { get; set; }
}
public class Duration
{
public virtual int Value { get; set; }
public virtual DurationUnit Unit { get; set; }
public virtual int DurationInMinutes { get{ throw new NotImplementedException(); } }
}
public class Event
{
public virtual int Id { get; set; }
public virtual String Name { get; set; }
public virtual Duration MaxDuration { get; set; }
public virtual Duration MinDuration { get; set; }
}
나의 초기 접근 방식은 기간을 이벤트의 구성 요소로 사용하여 DurationUnit 및 Event에 대한 ClassMap을 선언하는 것이 었습니다.
이NHibernate.MappingException :에 대한 유형을 결정 할 수 없습니다 : 당신의 매핑이
public EventMap() { Component(x => x.MaxDuration, c => { c.Map(x => x.Value, "MaxDurationValue"); c.Reference(x => x.Unit, "MaxDurationUnitId"); }); }
과 같은 경우 Entities.DurationUnit
잘 작동합니다. 나는 멍청이 였고 내 구성 요소 매핑 내에서 참조보다는지도를 사용하고있었습니다. 많은 감사합니다! – TonE