⚠ Deprecated: Legacy, CriticalBugs
请使用 Cordon.AspNetCore 替代 Limen.AspNetCore 包。
Suggested alternative: Cordon.AspNetCore
Furion 框架数据验证模块。
$ dotnet add package Limen.AspNetCoreLimen is a highly expressive data validation library built for .NET developers. With its fluent syntax and extensible rule engine, it establishes precise "guardrails" for data flows. Whether validating API inputs, form submissions, or cleansing heterogeneous data streams, Limen enables enterprise-grade validation with minimal code.
dotnet add package Limen
We have many examples on our homepage. Here's your first one to get you started:
public class User : IValidatableObject
{
[Min(1, ErrorMessage = "{0} must not be less than 1")]
public int Id { get; set; }
[Required]
public string? Name { get; set; }
public IEnumerable<ValidationResult> Validate(ValidationContext context)
{
return context.ContinueWith<User>()
.RuleFor(u => u.Name).NotBlank().MinLength(3).UserName().WithMessage("{0} 不是有效的互联网用户名")
.RuleFor(u => u.Id).Max(int.MaxValue)
.RuleSet("rule", validator =>
{
validator.RuleFor(u => u.Name).EmailAddress().WithMessage("{0} 不是有效的电子邮箱格式");
}).ToResults();
}
}
You can find the Limen documentation on our homepage.
The main purpose of this repository is to continue developing the core of Limen, making it faster and easier to use. The development of Limen is publicly hosted on Gitee, and we appreciate community contributions for bug fixes and improvements.
Limen is released under the MIT open source license.