using System; using System.Data.Common; namespace EasyDev.Database { /// /// /// public static class ExceptionBuilder { /// /// Transactions the error. /// /// The message. /// public static Exception TransactionError(string message) { return new Exception(message); } /// /// Nots the supported exception. /// /// The message. /// public static Exception NotSupportedException(string message = null) { return new NotSupportedException(message); } /// /// Arguments the null. /// /// The message. /// public static Exception ArgumentNull(string message = null) { return new ArgumentNullException(message); } /// /// Arguments the out of range. /// /// The message. /// public static Exception ArgumentOutOfRange(string message = null) { return new ArgumentOutOfRangeException(message); } /// /// Invalids the length of the offset. /// /// The message. /// public static Exception InvalidOffsetLength(string message = null) { return new ArgumentException(message); } /// /// Columns the out of range. /// /// The index. /// public static Exception ColumnOutOfRange(int index) { return new IndexOutOfRangeException(); } /// /// Columns the not in entity. /// /// Name of the column. /// Name of the entity. /// public static Exception ColumnNotInEntity(string columnName, string entityName) { return new ArgumentException(); } /// /// Columns the out of range. /// /// The index. /// Name of the entity. /// public static Exception ColumnOutOfRange(int index, string entityName) { return new ArgumentException(); } /// /// Arguments the type not support. /// /// Name of the type. /// public static Exception ArgumentTypeNotSupport(string typeName) { return new ArgumentException(typeName); } /// /// Nots the implemented exception. /// /// The message. /// public static Exception NotImplementedException(string message = null) { return new NotImplementedException(message); } /// /// Invalids the cast exception. /// /// From type. /// To type. /// public static Exception InvalidCastException(Type fromType, Type toType) { return new InvalidCastException($"Type: {fromType.Name} not cast to {toType.Name}"); } /// /// Concurrencies the exception. /// /// The message. /// public static Exception ConcurrencyException(string message) { return new ConcurrencyException(message); } } }