Example #1
0
        /// <summary>
        /// Gets a value on the entity.
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="fields"></param>
        /// <returns></returns>
        public object[] GetValues(object entity, EntityField[] fields, FetchFlags fetchFlags)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            if (fields == null)
            {
                throw new ArgumentNullException("fields");
            }
            if (fields.Length == 0)
            {
                return new object[] {}
            }
            ;

            // defer...
            return(this.GetValues(entity, fields, ConversionFlags.Safe, fetchFlags));
        }
Example #2
0
        /// <summary>
        /// Gets a value from the instance.
        /// </summary>
        /// <param name="field"></param>
        /// <returns></returns>
        public object GetValue(object entity, EntityField field, FetchFlags flags)
        {
            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...
            return(this.GetValue(entity, field, ConversionFlags.Safe));
        }
Example #3
0
        /// <summary>
        /// Gets a value on the entity.
        /// </summary>
        /// <param name="entity"></param>
        /// <param name="fields"></param>
        /// <returns></returns>
        public object[] GetValues(object entity, EntityField[] fields, ConversionFlags flags, FetchFlags fetchFlags)
        {
            if (entity == null)
            {
                throw new ArgumentNullException("entity");
            }
            if (fields == null)
            {
                throw new ArgumentNullException("fields");
            }
            if (fields.Length == 0)
            {
                return new object[] {}
            }
            ;

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

            // create...
            object[] results = new object[fields.Length];
            for (int index = 0; index < fields.Length; index++)
            {
                results[index] = this.GetValue(entity, fields[index], flags, fetchFlags);
            }

            // return...
            return(results);
        }