/// <summary>
    ///     Returns the store value generation strategy to set for the given property.
    /// </summary>
    /// <param name="property">The property.</param>
    /// <returns>The store value generation strategy to set for the given property.</returns>
    protected override ValueGenerated?GetValueGenerated(IConventionProperty property)
    {
        var entityType   = property.DeclaringEntityType;
        var propertyType = property.ClrType.UnwrapNullableType();

        if (propertyType == typeof(int))
        {
            var ownership = entityType.FindOwnership();
            if (ownership != null &&
                !ownership.IsUnique &&
                !entityType.IsDocumentRoot())
            {
                var pk = property.FindContainingPrimaryKey();
                if (pk != null &&
                    !ownership.Properties.Contains(property) &&
                    pk.Properties.Count == ownership.Properties.Count + 1 &&
                    ownership.Properties.All(fkProperty => pk.Properties.Contains(fkProperty)))
                {
                    return(base.GetValueGenerated(property));
                }
            }
        }

        if (propertyType != typeof(Guid))
        {
            return(null);
        }

        return(base.GetValueGenerated(property));
    }
 /// <summary>
 ///     Returns the store value generation strategy to set for the given property.
 /// </summary>
 /// <param name="property"> The property. </param>
 /// <returns> The store value generation strategy to set for the given property. </returns>
 public virtual ValueGenerated?GetValueGenerated([NotNull] IConventionProperty property)
 => !property.IsForeignKey() &&
 property.FindContainingPrimaryKey()?.Properties.Count(p => !p.IsForeignKey()) == 1 &&
 CanBeGenerated(property)
         ? ValueGenerated.OnAdd
         : (ValueGenerated?)null;