nhibernate mapping could not determinate type - jak to rozwiązać?

0

Hej,

mam taki o to kod:

public class LoungePassenger
    {
        public virtual bool Required { get; set; }
        public virtual bool CountsToGuests { get; set; }
        public virtual int Id { get; set; }
        public virtual DateTime StartDate { get; set; }       

        public virtual Price Price { get; set; }
        public virtual Lounge Lounge { get; set; }
        public virtual Passenger Passenger { get; set; }
    }

następnie robię mapping:


public class LoungePassengerMap: ClassMap<LoungePassenger>
    {
        public LoungePassengerMap()
        {
            this.Id(x => x.Id).Not.Nullable();
            this.Map(x => x.CountsToGuests);
            this.Map(x => x.Required);
            this.Map(x => x.Price).CustomType<PriceType>();
            this.Map(x => x.StartDate);

            this.References(x => x.Lounge).Not.Nullable();
            this.References(x => x.Passenger).Not.Nullable();         

        }

Kod Price:


 public class Price
    {
        public decimal Value { get; set; }
        public Price(decimal gbp)
        {
            this.Value = gbp;
        }
    }

oraz kod PriceType:

public class PriceType: IUserType
    {
        public new bool Equals(object x, object y)
        {
            if (x == null) return false;
            return x.Equals(y);
        }

        public int GetHashCode(object x)
        {
            return x.GetHashCode();
        }

        public object NullSafeGet(IDataReader rs, string[] names, object owner)
        {
            decimal uriString = (decimal)NHibernateUtil.Decimal.NullSafeGet(rs, names[0]);
            var result = new Price(uriString);
            return result;
        }

        public void NullSafeSet(IDbCommand cmd, object value, int index)
        {
            if (value == null)
            {
                NHibernateUtil.Decimal.NullSafeSet(cmd,null, index);
                return;
            }
            value = (decimal)value;
            NHibernateUtil.Decimal.NullSafeSet(cmd,value,index);
        }

        public object DeepCopy(object value)
        {
            if (value == null) return null;
            return new Price(((Price)value).Value);
        }

        public object Replace(object original, object target, object owner)
        {
            return original;
        }

        public object Assemble(object cached, object owner)
        {
            return cached;
        }

        public object Disassemble(object value)
        {
            return value;
        }

        public SqlType[] SqlTypes
        {
            get
            {
                SqlType[] types = new SqlType[1];
                types[0] = new SqlType(DbType.Decimal);
                return types;
            }
        }

        public Type ReturnedType { get
        {
            return typeof(Price);
        } }

        public bool IsMutable 
        { 
            get { return false; } 
        }
    }

Po odpaleniu dostaje błąd "Could not determine type for: Domain.Helpers.Price, Domain, Version=1.0.0.0, Culture=neutral, PublicKeyToken=null, for columns: NHibernate.Mapping.Column(Price)"
Co jest tego przyczyną? Jak mogę rozwiązać ten problem?

0

nikt? :(

1 użytkowników online, w tym zalogowanych: 0, gości: 1, botów: 0