Beispiel #1
0
 /// <summary>
 /// Create update values.
 /// </summary>
 /// <param name="Object">The object.</param>
 /// <param name="Action">The action.</param>
 protected override void _CreateUpdateValues(T Object, Action <string, object> Action)
 {
     // Map the object properties to an action.
     UtilityMapper <T> .Map(Object, (Key, Value) => {
         // Check if this property is not the primary key.
         if (_PrimaryKey.Name != Key)
         {
             // Invoke the action.
             Action(Key, Value);
         }
     });
 }
        /// <summary>
        /// Retrieve the result.
        /// </summary>
        /// <param name="DataReader">The data reader.</param>
        public static T Single <T>(this DbDataReader DataReader) where T : class, new()
        {
            // Check if a column is available.
            if (DataReader.FieldCount > 0)
            {
                // Initialize a new instance of the T class.
                T Object = new T();
                // Map the object properties from a data reader.
                UtilityMapper <T> .Map(Object, DataReader);

                // Return the object.
                return(Object);
            }
            // Return null.
            return(null);
        }