Exemple #1
0
    /// <summary>
    ///     Validates the mapping/configuration of change tracking in the model.
    /// </summary>
    /// <param name="model">The model to validate.</param>
    /// <param name="logger">The logger to use.</param>
    protected virtual void ValidateChangeTrackingStrategy(
        IModel model,
        IDiagnosticsLogger <DbLoggerCategory.Model.Validation> logger)
    {
        var requireFullNotifications = (bool?)model[CoreAnnotationNames.FullChangeTrackingNotificationsRequired] == true;

        foreach (var entityType in model.GetEntityTypes())
        {
            var errorMessage = EntityType.CheckChangeTrackingStrategy(
                entityType, entityType.GetChangeTrackingStrategy(), requireFullNotifications);

            if (errorMessage != null)
            {
                throw new InvalidOperationException(errorMessage);
            }
        }
    }