1
0
mirror of synced 2024-11-25 04:03:09 +01:00
Tapeti/Tapeti.DataAnnotations/DataAnnotationsPublishMiddleware.cs

19 lines
507 B
C#
Raw Normal View History

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