1
0
mirror of synced 2024-11-05 02:59:16 +00:00
Tapeti/Tapeti.DataAnnotations/DataAnnotationsMessageMiddleware.cs

19 lines
507 B
C#
Raw Normal View History

2017-02-12 20:43:30 +00:00
using System;
using System.ComponentModel.DataAnnotations;
using System.Threading.Tasks;
using Tapeti.Config;
namespace Tapeti.DataAnnotations
{
public class DataAnnotationsMessageMiddleware : IMessageMiddleware
{
public Task Handle(IMessageContext context, Func<Task> next)
{
var validationContext = new ValidationContext(context.Message);
Validator.ValidateObject(context.Message, validationContext, true);
2017-02-12 20:43:30 +00:00
return next();
}
}
}