Can you specify the "smaller" object for property iteration?

May 2, 2012 at 2:50 AM

I have this issue where I have a smaller object, and a larger object.

The larger object has a property on it that throws an exception when reading from it.
I am using the NullableToNormals convention.

It appears that value injecter is looping over every property on the parent object for some reason, actually reading the values, and then attempting to inject that into the smaller object whether or not the property exists.

The model being injected into is the smaller one.

Can I specify that it should do the iteration over the smaller of the two objects so this error goes away?

result.InjectFrom<NullablesToNormal>(item);

This is in my larger object:

[Obsolete("This property is here for NHibernate to work properly with a legacy database schema. Don't use it, use the Cancellation property instead.")]
        public virtual IEnumerable<Cancellation> Cancellations
        {
            get
            {
                throw new NotImplementedException("This property is here for NHibernate to work properly with a legacy database schema. Don't use it, use the Cancellation property instead.");
            }
        }

This is my model:

public class BidModel
    {
        public int Id { get; set; }
        public bool Accepted { get; set; }
        public bool Deleted { get; set; }
        public bool AutoAccept { get; set; }
        public DateTime DateCreated { get; set; }
        public int ServiceTypeID { get; set; }
        public BookingStatus Status { get; set; }
    }

May 2, 2012 at 9:08 AM

yes, that's what ConventionInjection does, it reads everything and if something matches sets the value,

Try using the SmartConventionInjection instead, that one will not read the value and it works faster