Skip to content

Release v7.24.0

Choose a tag to compare

@github-actions github-actions released this 12 Oct 21:06
94dca41

Summary

Concepts whose new values depend on the clock or the tenant can now declare that, and GenerateValue adds ULID, TypeID, Nano ID and random-bytes strategies, all from a cryptographically secure generator on .NET 8, 9 and 10.

Added

  • IGeneratableInContext<TSelf> in Cratis.Concepts: a concept implements static TSelf New(GenerationContext context) when its value depends on the operation's time or tenant; when a type implements both interfaces, callers use the context form (part of #1176)
  • GenerationContext(Now, Tenant): the instant the operation was received and the portable tenant identifier, with GenerationContext.DefaultTenant (the zero GUID) for the default tenant (part of #1176)
  • GenerateValue.Ulid(): 26 uppercase Crockford base32 characters with a millisecond timestamp and 80 random bits (part of #1176)
  • GenerateValue.TypeId(prefix): a TypeID with a validated lowercase prefix and a UUID v7 suffix (part of #1176)
  • GenerateValue.NanoId(size, alphabet): characters drawn uniformly from the default URL-safe alphabet or a custom one (part of #1176)
  • GenerateValue.Bytes(count, encoding): random bytes as unpadded base64url, lowercase hex or unpadded RFC 4648 base32 (part of #1176)
  • GenerateValue.UuidV7(context), Ulid(context) and TypeId(prefix, context) take their timestamp from context.Now, so a pinned clock pins the time part of the value (part of #1176)
  • Documentation on choosing a strategy and on context-aware generation: https://github.com/Cratis/Fundamentals/blob/main/Documentation/csharp/generating-values.md (part of #1176)