Merge tag '1.3.1' into develop
This commit is contained in:
commit
263e364a84
34
Tapeti.DataAnnotations.Extensions/RequiredGuidAttribute.cs
Normal file
34
Tapeti.DataAnnotations.Extensions/RequiredGuidAttribute.cs
Normal file
@ -0,0 +1,34 @@
|
|||||||
|
using System;
|
||||||
|
using System.ComponentModel.DataAnnotations;
|
||||||
|
using System.Globalization;
|
||||||
|
|
||||||
|
namespace Tapeti.DataAnnotations.Extensions
|
||||||
|
{
|
||||||
|
/// <summary>
|
||||||
|
/// Can be used on Guid fields which are supposed to be Required, as the Required attribute does
|
||||||
|
/// not work for Guids and making them Nullable is counter-intuitive.
|
||||||
|
/// </summary>
|
||||||
|
public class RequiredGuidAttribute : ValidationAttribute
|
||||||
|
{
|
||||||
|
private const string DefaultErrorMessage = "'{0}' does not contain a valid guid";
|
||||||
|
private const string InvalidTypeErrorMessage = "'{0}' is not of type Guid";
|
||||||
|
|
||||||
|
public RequiredGuidAttribute() : base(DefaultErrorMessage)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override ValidationResult IsValid(object value, ValidationContext validationContext)
|
||||||
|
{
|
||||||
|
if (value == null)
|
||||||
|
return new ValidationResult(FormatErrorMessage(validationContext.DisplayName));
|
||||||
|
|
||||||
|
if (value.GetType() != typeof(Guid))
|
||||||
|
return new ValidationResult(string.Format(InvalidTypeErrorMessage, validationContext.DisplayName));
|
||||||
|
|
||||||
|
var guid = (Guid)value;
|
||||||
|
return guid == Guid.Empty
|
||||||
|
? new ValidationResult(FormatErrorMessage(validationContext.DisplayName))
|
||||||
|
: null;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
@ -0,0 +1,11 @@
|
|||||||
|
<Project Sdk="Microsoft.NET.Sdk">
|
||||||
|
|
||||||
|
<PropertyGroup>
|
||||||
|
<TargetFramework>netstandard2.0</TargetFramework>
|
||||||
|
</PropertyGroup>
|
||||||
|
|
||||||
|
<ItemGroup>
|
||||||
|
<PackageReference Include="System.ComponentModel.Annotations" Version="4.5.0" />
|
||||||
|
</ItemGroup>
|
||||||
|
|
||||||
|
</Project>
|
@ -0,0 +1,23 @@
|
|||||||
|
<?xml version="1.0"?>
|
||||||
|
<package >
|
||||||
|
<metadata>
|
||||||
|
<id>Tapeti.DataAnnotations.Extensions</id>
|
||||||
|
<version>$version$</version>
|
||||||
|
<title>Tapeti DataAnnotations Extensions</title>
|
||||||
|
<authors>Mark van Renswoude</authors>
|
||||||
|
<owners>Mark van Renswoude</owners>
|
||||||
|
<licenseUrl>https://raw.githubusercontent.com/MvRens/Tapeti/master/UNLICENSE</licenseUrl>
|
||||||
|
<projectUrl>https://github.com/MvRens/Tapeti</projectUrl>
|
||||||
|
<iconUrl>https://raw.githubusercontent.com/MvRens/Tapeti/master/resources/icons/Tapeti.DataAnnotations.png</iconUrl>
|
||||||
|
<requireLicenseAcceptance>false</requireLicenseAcceptance>
|
||||||
|
<description>Additional DataAnnotations attributes. Not specific to Tapeti, but useful for annotating message classes.</description>
|
||||||
|
<copyright></copyright>
|
||||||
|
<tags>rabbitmq tapeti dataannotations</tags>
|
||||||
|
<dependencies>
|
||||||
|
<dependency id="System.ComponentModel.Annotations" version="4.5.0" />
|
||||||
|
</dependencies>
|
||||||
|
</metadata>
|
||||||
|
<files>
|
||||||
|
<file src="bin\Release\**" target="lib" />
|
||||||
|
</files>
|
||||||
|
</package>
|
@ -10,7 +10,7 @@ namespace Tapeti.DataAnnotations
|
|||||||
public Task Handle(IMessageContext context, Func<Task> next)
|
public Task Handle(IMessageContext context, Func<Task> next)
|
||||||
{
|
{
|
||||||
var validationContext = new ValidationContext(context.Message);
|
var validationContext = new ValidationContext(context.Message);
|
||||||
Validator.ValidateObject(context.Message, validationContext);
|
Validator.ValidateObject(context.Message, validationContext, true);
|
||||||
|
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
@ -10,7 +10,7 @@ namespace Tapeti.DataAnnotations
|
|||||||
public Task Handle(IPublishContext context, Func<Task> next)
|
public Task Handle(IPublishContext context, Func<Task> next)
|
||||||
{
|
{
|
||||||
var validationContext = new ValidationContext(context.Message);
|
var validationContext = new ValidationContext(context.Message);
|
||||||
Validator.ValidateObject(context.Message, validationContext);
|
Validator.ValidateObject(context.Message, validationContext, true);
|
||||||
|
|
||||||
return next();
|
return next();
|
||||||
}
|
}
|
||||||
|
@ -21,7 +21,9 @@ Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tapeti.Tests", "Tapeti.Test
|
|||||||
EndProject
|
EndProject
|
||||||
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tapeti.Serilog", "Tapeti.Serilog\Tapeti.Serilog.csproj", "{43AA5DF3-49D5-4795-A290-D6511502B564}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tapeti.Serilog", "Tapeti.Serilog\Tapeti.Serilog.csproj", "{43AA5DF3-49D5-4795-A290-D6511502B564}"
|
||||||
EndProject
|
EndProject
|
||||||
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tapeti.Transient", "Tapeti.Transient\Tapeti.Transient.csproj", "{A6355E63-19AB-47EA-91FA-49B5E9B41F88}"
|
Project("{9A19103F-16F7-4668-BE54-9A1E7A4F7556}") = "Tapeti.Transient", "Tapeti.Transient\Tapeti.Transient.csproj", "{A6355E63-19AB-47EA-91FA-49B5E9B41F88}"
|
||||||
|
EndProject
|
||||||
|
Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "Tapeti.DataAnnotations.Extensions", "Tapeti.DataAnnotations.Extensions\Tapeti.DataAnnotations.Extensions.csproj", "{1AAA5A2C-EAA8-4C49-96A6-673EA1EEE831}"
|
||||||
EndProject
|
EndProject
|
||||||
Global
|
Global
|
||||||
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
GlobalSection(SolutionConfigurationPlatforms) = preSolution
|
||||||
@ -69,6 +71,10 @@ Global
|
|||||||
{A6355E63-19AB-47EA-91FA-49B5E9B41F88}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
{A6355E63-19AB-47EA-91FA-49B5E9B41F88}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
{A6355E63-19AB-47EA-91FA-49B5E9B41F88}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
{A6355E63-19AB-47EA-91FA-49B5E9B41F88}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
{A6355E63-19AB-47EA-91FA-49B5E9B41F88}.Release|Any CPU.Build.0 = Release|Any CPU
|
{A6355E63-19AB-47EA-91FA-49B5E9B41F88}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
|
{1AAA5A2C-EAA8-4C49-96A6-673EA1EEE831}.Debug|Any CPU.ActiveCfg = Debug|Any CPU
|
||||||
|
{1AAA5A2C-EAA8-4C49-96A6-673EA1EEE831}.Debug|Any CPU.Build.0 = Debug|Any CPU
|
||||||
|
{1AAA5A2C-EAA8-4C49-96A6-673EA1EEE831}.Release|Any CPU.ActiveCfg = Release|Any CPU
|
||||||
|
{1AAA5A2C-EAA8-4C49-96A6-673EA1EEE831}.Release|Any CPU.Build.0 = Release|Any CPU
|
||||||
EndGlobalSection
|
EndGlobalSection
|
||||||
GlobalSection(SolutionProperties) = preSolution
|
GlobalSection(SolutionProperties) = preSolution
|
||||||
HideSolutionNode = FALSE
|
HideSolutionNode = FALSE
|
||||||
|
11
appveyor.yml
11
appveyor.yml
@ -9,21 +9,32 @@ before_build:
|
|||||||
- ps: gitversion /l console /output buildserver /updateAssemblyInfo
|
- ps: gitversion /l console /output buildserver /updateAssemblyInfo
|
||||||
|
|
||||||
after_build:
|
after_build:
|
||||||
|
# Tapeti
|
||||||
- cmd: ECHO nuget pack Tapeti\Tapeti.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
- cmd: ECHO nuget pack Tapeti\Tapeti.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
||||||
- cmd: nuget pack Tapeti\Tapeti.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
- cmd: nuget pack Tapeti\Tapeti.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
||||||
- cmd: appveyor PushArtifact "Tapeti.%GitVersion_NuGetVersion%.nupkg"
|
- cmd: appveyor PushArtifact "Tapeti.%GitVersion_NuGetVersion%.nupkg"
|
||||||
|
# Tapeti.Annotations
|
||||||
- cmd: nuget pack Tapeti.Annotations\Tapeti.Annotations.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
- cmd: nuget pack Tapeti.Annotations\Tapeti.Annotations.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
||||||
- cmd: appveyor PushArtifact "Tapeti.Annotations.%GitVersion_NuGetVersion%.nupkg"
|
- cmd: appveyor PushArtifact "Tapeti.Annotations.%GitVersion_NuGetVersion%.nupkg"
|
||||||
|
# Tapeti.DataAnnotations
|
||||||
- cmd: nuget pack Tapeti.DataAnnotations\Tapeti.DataAnnotations.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
- cmd: nuget pack Tapeti.DataAnnotations\Tapeti.DataAnnotations.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
||||||
- cmd: appveyor PushArtifact "Tapeti.DataAnnotations.%GitVersion_NuGetVersion%.nupkg"
|
- cmd: appveyor PushArtifact "Tapeti.DataAnnotations.%GitVersion_NuGetVersion%.nupkg"
|
||||||
|
# Tapeti.DataAnnotations.Extensions
|
||||||
|
- cmd: nuget pack Tapeti.DataAnnotations.Extensions\Tapeti.DataAnnotations.Extensions.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
||||||
|
- cmd: appveyor PushArtifact "Tapeti.DataAnnotations.Extensions.%GitVersion_NuGetVersion%.nupkg"
|
||||||
|
# Tapeti.Flow
|
||||||
- cmd: nuget pack Tapeti.Flow\Tapeti.Flow.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
- cmd: nuget pack Tapeti.Flow\Tapeti.Flow.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
||||||
- cmd: appveyor PushArtifact "Tapeti.Flow.%GitVersion_NuGetVersion%.nupkg"
|
- cmd: appveyor PushArtifact "Tapeti.Flow.%GitVersion_NuGetVersion%.nupkg"
|
||||||
|
# Tapeti.Flow.SQL
|
||||||
- cmd: nuget pack Tapeti.Flow.SQL\Tapeti.Flow.SQL.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
- cmd: nuget pack Tapeti.Flow.SQL\Tapeti.Flow.SQL.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
||||||
- cmd: appveyor PushArtifact "Tapeti.Flow.SQL.%GitVersion_NuGetVersion%.nupkg"
|
- cmd: appveyor PushArtifact "Tapeti.Flow.SQL.%GitVersion_NuGetVersion%.nupkg"
|
||||||
|
# Tapeti.Transient
|
||||||
- cmd: nuget pack Tapeti.Transient\Tapeti.Transient.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
- cmd: nuget pack Tapeti.Transient\Tapeti.Transient.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
||||||
- cmd: appveyor PushArtifact "Tapeti.Transient.%GitVersion_NuGetVersion%.nupkg"
|
- cmd: appveyor PushArtifact "Tapeti.Transient.%GitVersion_NuGetVersion%.nupkg"
|
||||||
|
# Tapeti.SimpleInjector
|
||||||
- cmd: nuget pack Tapeti.SimpleInjector\Tapeti.SimpleInjector.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
- cmd: nuget pack Tapeti.SimpleInjector\Tapeti.SimpleInjector.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
||||||
- cmd: appveyor PushArtifact "Tapeti.SimpleInjector.%GitVersion_NuGetVersion%.nupkg"
|
- cmd: appveyor PushArtifact "Tapeti.SimpleInjector.%GitVersion_NuGetVersion%.nupkg"
|
||||||
|
# Tapeti.Serilog
|
||||||
- cmd: nuget pack Tapeti.Serilog\Tapeti.Serilog.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
- cmd: nuget pack Tapeti.Serilog\Tapeti.Serilog.nuspec -version "%GitVersion_NuGetVersion%" -prop "target=%CONFIGURATION%"
|
||||||
- cmd: appveyor PushArtifact "Tapeti.Serilog.%GitVersion_NuGetVersion%.nupkg"
|
- cmd: appveyor PushArtifact "Tapeti.Serilog.%GitVersion_NuGetVersion%.nupkg"
|
||||||
|
|
||||||
|
Loading…
Reference in New Issue
Block a user