![]() |
VOOZH | about |
dotnet add package Metalama.Patterns.Contracts --version 2026.1.18
NuGet\Install-Package Metalama.Patterns.Contracts -Version 2026.1.18
<PackageReference Include="Metalama.Patterns.Contracts" Version="2026.1.18" />
<PackageVersion Include="Metalama.Patterns.Contracts" Version="2026.1.18" />Directory.Packages.props
<PackageReference Include="Metalama.Patterns.Contracts" />Project file
paket add Metalama.Patterns.Contracts --version 2026.1.18
#r "nuget: Metalama.Patterns.Contracts, 2026.1.18"
#:package Metalama.Patterns.Contracts@2026.1.18
#addin nuget:?package=Metalama.Patterns.Contracts&version=2026.1.18Install as a Cake Addin
#tool nuget:?package=Metalama.Patterns.Contracts&version=2026.1.18Install as a Cake Tool
The Metalama.Patterns.Contracts package implements the concept of contract-based programming, encompassing preconditions, postconditions, and invariants.
Below is a list of available contract attributes for your selection:
[NotNull] verifies that the assigned value is not null.[Required] contract verifies that the value is not null and requires the string to be non-empty.[NotEmpty] requires the string to be non-empty. Note that this contract does not validate the string against being null. If you want to prohibit both null and empty strings, use [Required].[CreditCard] validates that the string is a valid credit card number.[Email], [Phone], and [Url] validate strings against well-known regular expressions.[Regex] validates a string against a custom regular expression.[StringLength] validates that the length of a string falls within a specified range.[EnumDataType] contract can validate values of type string, object, or of any integer type. It throws an exception if the value is not valid for the given enum type.The following contracts can be used to verify that a value falls within a specified range:
[LessThan] verifies that the value is less than or equal to the specified maximum.[GreaterThan] verifies that the value is greater than or equal to the specified minimum.[Negative] verifies that the value is less than or equal to zero.[Positive] verifies that the value is greater than or equal to zero.[Range] verifies that the value is greater than or equal to a specified minimum and less than or equal to a specified maximum.[StrictlyLessThan] verifies that the value is strictly less than the specified maximum.[StrictlyGreaterThan] verifies that the value is strictly greater than the specified minimum.[StrictlyNegative] verifies that the value is strictly less than zero.[StrictlyPositive] verifies that the value is strictly greater than zero.[StrictRange] verifies that the value is strictly greater than a specified minimum and strictly less than a specified maximum.[NotEmpty] contract can be used on any collection, including arrays or immutable arrays. It requires the collection or the array to contain at least one element.[Invariant] causes the target method (a parameterless void method) to be invoked after each public method or property setter.[DoNotCheckInvariants] exempts the target method from enforcing invariants, but does not exempt any method or property setter used by this method.[SuspendInvariant] exempts the target method from enforcing invariants, including any method or property setter used by this method.| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net5.0 net5.0 was computed. net5.0-windows net5.0-windows was computed. net6.0 net6.0 was computed. net6.0-android net6.0-android was computed. net6.0-ios net6.0-ios was computed. net6.0-maccatalyst net6.0-maccatalyst was computed. net6.0-macos net6.0-macos was computed. net6.0-tvos net6.0-tvos was computed. net6.0-windows net6.0-windows was computed. net7.0 net7.0 was computed. net7.0-android net7.0-android was computed. net7.0-ios net7.0-ios was computed. net7.0-maccatalyst net7.0-maccatalyst was computed. net7.0-macos net7.0-macos was computed. net7.0-tvos net7.0-tvos was computed. net7.0-windows net7.0-windows was computed. net8.0 net8.0 is compatible. net8.0-android net8.0-android was computed. net8.0-browser net8.0-browser was computed. net8.0-ios net8.0-ios was computed. net8.0-maccatalyst net8.0-maccatalyst was computed. net8.0-macos net8.0-macos was computed. net8.0-tvos net8.0-tvos was computed. net8.0-windows net8.0-windows was computed. net9.0 net9.0 was computed. net9.0-android net9.0-android was computed. net9.0-browser net9.0-browser was computed. net9.0-ios net9.0-ios was computed. net9.0-maccatalyst net9.0-maccatalyst was computed. net9.0-macos net9.0-macos was computed. net9.0-tvos net9.0-tvos was computed. net9.0-windows net9.0-windows was computed. net10.0 net10.0 was computed. net10.0-android net10.0-android was computed. net10.0-browser net10.0-browser was computed. net10.0-ios net10.0-ios was computed. net10.0-maccatalyst net10.0-maccatalyst was computed. net10.0-macos net10.0-macos was computed. net10.0-tvos net10.0-tvos was computed. net10.0-windows net10.0-windows was computed. |
| .NET Core | netcoreapp2.0 netcoreapp2.0 was computed. netcoreapp2.1 netcoreapp2.1 was computed. netcoreapp2.2 netcoreapp2.2 was computed. netcoreapp3.0 netcoreapp3.0 was computed. netcoreapp3.1 netcoreapp3.1 was computed. |
| .NET Standard | netstandard2.0 netstandard2.0 is compatible. netstandard2.1 netstandard2.1 was computed. |
| .NET Framework | net461 net461 was computed. net462 net462 was computed. net463 net463 was computed. net47 net47 was computed. net471 net471 was computed. net472 net472 is compatible. net48 net48 was computed. net481 net481 was computed. |
| MonoAndroid | monoandroid monoandroid was computed. |
| MonoMac | monomac monomac was computed. |
| MonoTouch | monotouch monotouch was computed. |
| Tizen | tizen40 tizen40 was computed. tizen60 tizen60 was computed. |
| Xamarin.iOS | xamarinios xamarinios was computed. |
| Xamarin.Mac | xamarinmac xamarinmac was computed. |
| Xamarin.TVOS | xamarintvos xamarintvos was computed. |
| Xamarin.WatchOS | xamarinwatchos xamarinwatchos was computed. |
Showing the top 5 NuGet packages that depend on Metalama.Patterns.Contracts:
| Package | Downloads |
|---|---|
|
Shinya.Core
Shinya.Framework |
|
|
Metalama.Patterns.Caching.Aspects
A set of aspects that simplify the caching: [Cache] to cache a method result as a function of its parameters, [InvalidateCache] to invalidate the cache, or [CacheKey] to mark a cache key in a class. |
|
|
Metalama.Patterns.Caching.Backends.Redis
Redis back-end for Metalama.Patterns.Caching. Implements both caching and cache invalidation over Redis Pub/Sub |
|
|
Metalama.Patterns.Caching.Backends.Azure
Synchronizes the invalidation of distributed Metalama.Patterns.Caching caches over Azure Service Bus. |
|
|
Metalama.Patterns.Wpf
Automatically implements WPF dependency properties from a C# automatic property and WPF commands from a C# method thanks to Metalama. |
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 2026.1.18 | 471 | 6/10/2026 |
| 2026.1.17 | 248 | 6/5/2026 |
| 2026.1.16 | 438 | 6/3/2026 |
| 2026.1.15-rc | 2,129 | 5/15/2026 |
| 2026.1.14-rc | 514 | 5/13/2026 |
| 2026.1.13-preview | 216 | 5/13/2026 |
| 2026.1.12-preview | 524 | 5/12/2026 |
| 2026.1.11-preview | 664 | 5/6/2026 |
| 2026.1.10-preview | 1,002 | 4/29/2026 |
| 2026.1.9-preview | 659 | 4/17/2026 |
| 2026.1.8-preview | 353 | 4/13/2026 |
| 2026.1.7-preview | 805 | 3/31/2026 |
| 2026.1.6-preview | 454 | 3/28/2026 |
| 2026.1.5-preview | 221 | 3/26/2026 |
| 2026.1.4-preview | 317 | 3/22/2026 |
| 2026.0.23 | 1,429 | 5/15/2026 |
| 2026.0.22 | 788 | 4/29/2026 |
| 2026.0.21 | 450 | 4/17/2026 |
| 2026.0.20 | 445 | 3/25/2026 |
| 2026.0.19 | 239 | 3/24/2026 |