Skip to content

Search EricksonLopez.* Ecosystem

Type a library name, NuGet package ID, .NET type, or architectural concept to search across the portal.

Core Concepts — Attributes, SmartEnums & Validation

Every generated primitive is a readonly partial record struct whose private constructor is bypassed only by generated factory and parser entry points.

  • [StrongId<T>]: Strongly-typed identifier backed by Guid, long, int, or string (RejectEmpty = true by default).
  • [StringPrimitive]: Enforces length, regex, and normalization ([Trim], [UpperCase], [LowerCase], [Normalize], [NormalizeWhitespace]).
  • [NumericPrimitive<T>]: Enforces numeric bounds with checked arithmetic in v3.0.0.
  • [DatePrimitive]: Normalizes DateTime to UTC in v3.0.0 ([BirthDate], [BusinessDate], [ExpirationDate], [DateRange], [TimeRange]).
  • [SmartEnum<T>]: Exhaustive enumeration providing FromName(name, ignoreCase), TryFromName, All (ReadOnlyCollection<T>), Match(...), Map(...), and Switch(...).
  • [ValueObject]: Generates STJ validation hooks so deserialization enforces Create() invariants.
  • [CustomValidator<TValidator>]: Hooks custom ICustomValidator<T> business rules into generated Create/TryCreate.

Core ships 39+ preconfigured attributes including [Email], [Phone], [Url], [Slug], [CountryCode], [CurrencyCode], [LanguageCode], [IBAN], [ISBN], [VIN], [IPAddress], [MacAddress], [HexColor], [PasswordHash], [Username], [Money], [Price], [TaxRate], [Percentage], [Discount], [Quantity], [Weight], [Height], [Distance], [Temperature], [Age], [Score], and [Rating].

  • .IsDefault identifies uninitialized default(T) values.
  • In v3.0.0, explicit casts on default StrongId / DatePrimitive throw InvalidOperationException, and ToString() returns string.Empty.