public static T FlowMustBeNotNull <T>(T obj) { if (Obj.IsNull(obj)) { throw XFlowException.Create("Is expecting not null data, but it wasn't attended."); } return(obj); }
public T Read <T>([Localizable(false)] string fieldName) { if (IsDataNull) { throw XFlowException.Create($"Os dados deste {nameof(DbEntity)} não foram informados."); } var value = InternalReadField <T>(fieldName); return(value.CastTo <T>()); }
public static XException TranslateToException <TEntity>(this ServiceResponse <TEntity> @this, string message) { if (@this.Success) { return(null); } var builder = new StringBuilder(message); foreach (var validation in @this.ValidationResult.Validations) { // ReSharper disable LocalizableElement builder.Append($"\n\t- {validation.ErrorMessage}"); // ReSharper restore LocalizableElement } return(XFlowException.Create(builder.ToString())); }