Castle.ActiveRecord.ActiveRecordHooksBase.BeforeLoad C# (CSharp) Метод

BeforeLoad() защищенный Метод

Hook to transform the read data from the database before populating the object instance
protected BeforeLoad ( object id, IDictionary adapter ) : bool
id object id of the obejct
adapter IDictionary list of properties and their values
Результат bool
		protected virtual internal bool BeforeLoad(object id, IDictionary adapter)
		{
			OnLoad(id);

			return false;
		}

Usage Example

Пример #1
0
        /// <summary>
        /// Called just before an object is initialized
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="id"></param>
        /// <param name="propertyNames"></param>
        /// <param name="state"></param>
        /// <param name="types"></param>
        /// <remarks>
        /// The interceptor may change the <c>state</c>, which will be propagated to the persistent
        /// object. Note that when this method is called, <c>entity</c> will be an empty
        /// uninitialized instance of the class.</remarks>
        /// <returns><c>true</c> if the user modified the <c>state</c> in any way</returns>
        public override bool OnLoad(object entity, object id, object[] state, string[] propertyNames, IType[] types)
        {
            ActiveRecordHooksBase hookTarget = entity as ActiveRecordHooksBase;

            if (hookTarget != null)
            {
                return(hookTarget.BeforeLoad(id, new DictionaryAdapter(propertyNames, state)));
            }

            return(false);
        }