concept value generator in category entity framework

appears as: value generator, The value generator
Entity Framework Core in Action

This is an excerpt from Manning's book Entity Framework Core in Action.

Listing 8.8 A value generator producing a unique string with the Name property
public class OrderIdValueGenerator 
    : ValueGenerator<string>    #1  
{
    public override bool 
        GeneratesTemporaryValues => false;    #2  
    public override string Next    #3  
        (EntityEntry entry)
    {
        var name = entry.    #4  
            Property(nameof(DefaultEntity.Name))    #5  
                .CurrentValue;
        var uniqueNum = DateTime.UtcNow.Ticks;
        return $"{name}-{uniqueNum}";  #6  
    }
}

#1   Your value generator needs to inherit from EF Core’s ValueGenerator<T>.
#2   Set this to false if you want your value to be written to the database.
#3   Called when you Add the entity to the DbContext.
#4   Gives you access to the entity that the value generator creates a value for. You can access its properties, etc.
#5   Selects the property called Name and gets its current value
#6   You need to return a value of the type you’ve defined as T in the inherited ValueGenerator<T>.

This is the code to configure the use of a value generator:

The value generator is a specialized feature with limited applications, but one that’s worth knowing about. The next chapter shows you how to intercept writes to the database to add tracking or other information, which is more work but provides more capabilities than the value generator.