Dado.ComponentModel.Mutations
0.5.1
.NET Standard 1.4
.NET Framework 4.6.1
Install-Package Dado.ComponentModel.Mutations -Version 0.5.1
dotnet add package Dado.ComponentModel.Mutations --version 0.5.1
<PackageReference Include="Dado.ComponentModel.Mutations" Version="0.5.1" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Dado.ComponentModel.Mutations --version 0.5.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Dado.ComponentModel.Mutations, 0.5.1"
#r directive can be used in F# Interactive, C# scripting and .NET Interactive. Copy this into the interactive tool or source code of the script to reference the package.
// Install Dado.ComponentModel.Mutations as a Cake Addin
#addin nuget:?package=Dado.ComponentModel.Mutations&version=0.5.1
// Install Dado.ComponentModel.Mutations as a Cake Tool
#tool nuget:?package=Dado.ComponentModel.Mutations&version=0.5.1
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Sample Usage
The following class shows that a property should be converted to lowercase and replaced of invalid characters.
using System.Text.RegularExpressions;
public class User
{
private string _userName;
public string UserName {
get {
return _userName;
}
set {
value = value.ToLower();
_userName = Regex.Replace(value, @"[^a-z0-9._]", String.Empty);
}
}
}
Altering the example to use a mutation attributes will produce the following code.
using Dado.ComponentModel.DataMutations;
public class User
{
[
ToLower,
RegexReplace(@"[^a-z0-9._]")
]
public string UserName { get; set; }
}
Now, when Mutator.Mutate(context);
is executed the value of User.UserName
will be lowercased and have all invalid characters replaced.
Product | Versions |
---|---|
.NET | net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows |
.NET Core | netcoreapp1.0 netcoreapp1.1 netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1 |
.NET Standard | netstandard1.4 netstandard1.5 netstandard1.6 netstandard2.0 netstandard2.1 |
.NET Framework | net461 net462 net463 net47 net471 net472 net48 |
MonoAndroid | monoandroid |
MonoMac | monomac |
MonoTouch | monotouch |
Tizen | tizen30 tizen40 tizen60 |
Universal Windows Platform | uap uap10.0 |
Xamarin.iOS | xamarinios |
Xamarin.Mac | xamarinmac |
Xamarin.TVOS | xamarintvos |
Xamarin.WatchOS | xamarinwatchos |
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.
-
.NETFramework 4.6.1
- System.ComponentModel.Annotations (>= 4.1.0)
-
.NETStandard 1.4
- NETStandard.Library (>= 1.6.1)
- System.ComponentModel (>= 4.0.1)
- System.ComponentModel.Annotations (>= 4.1.0)
-
.NETStandard 2.0
- System.ComponentModel.Annotations (>= 4.1.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.