Skip to content

Migration from v9 to v10

Pawel Gerr edited this page Nov 28, 2025 · 2 revisions

Migration from v9 to v10

This guide covers breaking changes and new features when migrating from v9 to v10.

Breaking Changes Summary

Framework Support

  • Dropped support for .NET 7 - Minimum version is now .NET 8.0
  • Dropped support for Entity Framework Core 7 - Minimum version is now EF Core 8.0
  • Minimum .NET SDK increased to 8.0.416

Obsolete Types and Members Removed

All types and members previously marked with [Obsolete] have been deleted. This includes:

Entity Framework Core:

  • UseValueObjectValueConverter → Use UseThinktectureValueConverters instead
  • AddValueObjectConverters → Use AddThinktectureValueConverters instead

Interfaces:

  • IEnum<TKey> → Use ISmartEnum<TKey> instead
  • IEnum<TKey, T, TValidationError> → Use ISmartEnum<TKey, T, TValidationError> instead
  • IValueObjectFactory<TValue> → Use IObjectFactory<TValue> instead
  • IValueObjectFactory<T, TValue, TValidationError> → Use IObjectFactory<T, TValue, TValidationError> instead
  • IComplexValueObject interface deleted (implementation was already generated automatically)

Enums:

  • ValueObjectAccessModifier enum → Use AccessModifier enum instead

ASP.NET Core:

  • TrimmingSmartEnumModelBinder class deleted

Attributes:

  • Several obsolete attribute constructor overloads removed

Swashbuckle Update

  • Updated Swashbuckle.AspNetCore.SwaggerGen to 10.0.1 - If you use the Swashbuckle integration package, ensure compatibility with Swashbuckle 10.x

Entity Framework Core Configuration (BREAKING CHANGE)

v10 introduces a new, more structured configuration API for Entity Framework Core integration. The old callback-based approach is deprecated but still supported for backward compatibility.

What Changed

The UseThinktectureValueConverters method now accepts a Configuration object that provides:

  • Type-safe configuration for Smart Enums and Keyed Value Objects
  • Built-in max length strategies for automatic database column sizing
  • Better defaults with smart enum max length calculation out-of-the-box

Old API (v9 - Deprecated)

.UseThinktectureValueConverters(configureEnumsAndKeyedValueObjects: property =>
{
   if (property.ClrType == typeof(ProductType))
   {
      var maxLength = ProductType.Items.Max(i => i.Key.Length);
      property.SetMaxLength(maxLength + (10 - maxLength % 10)); // round up to next 10
   }
   else if (property.ClrType == typeof(ProductName))
   {
      property.SetMaxLength(200);
   }
})

New API (v10 - Recommended)

Option 1: Use default configuration (automatic max length for string-based smart enums)

.UseThinktectureValueConverters()
// or explicitly:
.UseThinktectureValueConverters(Configuration.Default)

Option 2: Custom configuration with strategies

.UseThinktectureValueConverters(new Configuration
{
   SmartEnums = new SmartEnumConfiguration
   {
      // Automatically calculates max length from items and rounds to next 10
      MaxLengthStrategy = DefaultSmartEnumMaxLengthStrategy.Instance
   },
   KeyedValueObjects = new KeyedValueObjectConfiguration
   {
      MaxLengthStrategy = new CustomKeyedValueObjectMaxLengthStrategy((type, keyType) =>
      {
         if (type == typeof(ProductName))
            return 200;

         return MaxLengthChange.None; // Max length stays unchanged
      })
   }
})

Clone this wiki locally