Beispiel #1
0
        /// <summary>
        /// Creates an <see cref="EntityResult<T>"/> indicating a failed identity operation, with a list of <paramref name="errors"/> if applicable.
        /// </summary>
        /// <param name="errors">An optional array of <see cref="IdentityError"/>s which caused the operation to fail.</param>
        /// <returns>An <see cref="EntityResult<T>"/> indicating a failed identity operation, with a list of <paramref name="errors"/> if applicable.</returns>
        public static EntityResult <T> Failed(params Error[] errors)
        {
            var result = new EntityResult <T> {
                Succeeded = false
            };

            if (errors != null)
            {
                result._errors.AddRange(errors);
            }
            return(result);
        }
Beispiel #2
0
        /// <summary>
        /// Creates an <see cref="EntityResult<T>"/> indicating a failed identity operation, with a list of <paramref name="errors"/> if applicable.
        /// </summary>
        /// <param name="errors">An optional array of <see cref="IdentityError"/>s which caused the operation to fail.</param>
        /// <returns>An <see cref="EntityResult<T>"/> indicating a failed identity operation, with a list of <paramref name="errors"/> if applicable.</returns>
        public static EntityResult <T> Failed(Exception ex, params Error[] errors)
        {
            try {
                // This source will need to be added to the Application EventLog manually
                // in order for IIS to write to the EventLog.
                // Powershell Command: [system.Diagnostics.EventLog]::CreateEventSource("Trading Tome", "Application")
                EventLog.WriteEntry("Altask", ex.ToString(), EventLogEntryType.Error);
            }
            catch (Exception) {
            }

            var result = new EntityResult <T> {
                Succeeded = false
            };

            if (errors != null)
            {
                result._errors.AddRange(errors);
            }
            return(result);
        }