Exemple #1
0
 public override void SetValue(object entity, object value, SetValueReason reason)
 {
     if (entity == null)
     {
         throw new ArgumentNullException("entity");
     }
     ((Entity)entity).SetValue(this, value, reason);
 }
        /// <summary>
        /// Gets a value from the instance.
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        public void SetValue(object entity, EntityField field, object value, SetValueReason reason)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            if (field == null)
            {
                throw new ArgumentNullException("field");
            }

            // check...
            if (EntityType == null)
            {
                throw new ArgumentNullException("EntityType");
            }
            this.EntityType.AssertIsOfType(entity);

            // cast...
            ((Entity)entity).SetValue(field, value, reason);
        }
        /// <summary>
        /// Sets a value on the entity.
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="fields"></param>
        /// <param name="values"></param>
        public void SetValues(object entity, EntityField[] fields, object[] values, SetValueReason reason)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            if (fields == null)
            {
                throw new ArgumentNullException("fields");
            }
            if (fields.Length == 0)
            {
                throw ExceptionHelper.CreateZeroLengthArgumentException("fields");
            }
            if (values == null)
            {
                throw new ArgumentNullException("values");
            }
            if (values.Length == 0)
            {
                throw ExceptionHelper.CreateZeroLengthArgumentException("values");
            }
            if (fields.Length != values.Length)
            {
                throw ExceptionHelper.CreateLengthMismatchException("fields", "values", fields.Length, values.Length);
            }

            // check...
            if (EntityType == null)
            {
                throw new ArgumentNullException("EntityType");
            }
            this.EntityType.AssertIsOfType(entity);

            // set...
            for (int index = 0; index < fields.Length; index++)
            {
                this.SetValue(entity, fields[index], values[index], reason);
            }
        }
Exemple #4
0
 /// <summary>
 /// Sets a value for a member.
 /// </summary>
 /// <param name="entity"></param>
 /// <param name="value"></param>
 // mbr - 2010-04-05 - added...
 public abstract void SetValue(object entity, object value, SetValueReason reason);
Exemple #5
0
 public override void SetValue(object entity, object value, SetValueReason reason)
 {
     throw new Exception("The method or operation is not implemented.");
 }