src/Shared/EntityFramework/ModelConfiguration/Configuration/ConventionsConfiguration.cs
/// <summary>
///     Enables one or more conventions for the <see cref="DbModelBuilder" />.
/// </summary>
/// <param name="conventions"> The conventions to be enabled. </param>
Enables one or more conventions for the .
Enables one or more conventions for the .
public void Add(params IConvention[] conventions)
        {
            Check.NotNull(conventions, "conventions");
            Debug.Assert(conventions.All(c => c != null));
            foreach (var c in conventions)
            {
                var invalidType = true;
                if (ConventionsTypeFilter.IsConfigurationConvention(c.GetType()))
                {
                    invalidType = false;
                    var existingConventionIndex = _configurationConventions.FindIndex(
                        initialConvention => _initialConventionSet.ConfigurationConventions.Contains(initialConvention));
                    existingConventionIndex = existingConventionIndex == -1
                        ? _configurationConventions.Count
                        : existingConventionIndex;
                    _configurationConventions.Insert(existingConventionIndex, c);
                }
                if (ConventionsTypeFilter.IsConceptualModelConvention(c.GetType()))
                {
                    invalidType = false;
                    _conceptualModelConventions.Add(c);
                }
                if (ConventionsTypeFilter.IsStoreModelConvention(c.GetType()))
                {
                    invalidType = false;
                    _storeModelConventions.Add(c);
                }
                if (ConventionsTypeFilter.IsConceptualToStoreMappingConvention(c.GetType()))
                {
                    invalidType = false;
                    _conceptualToStoreMappingConventions.Add(c);
                }
                if (invalidType)
                {
                    throw new InvalidOperationException(
                        Strings.ConventionsConfiguration_InvalidConventionType(c.GetType()));
                }
            }
        }
public void Add ( params IConvention [ ] conventions ) { Check . NotNull ( conventions , " " ) ; Debug . Assert ( conventions . All ( c => c != null ) ) ; foreach ( var c in conventions ) { var invalidType = true ; if ( ConventionsTypeFilter . IsConfigurationConvention ( c . GetType ( ) ) ) { invalidType = false ; var existingConventionIndex = _configurationConventions . FindIndex ( initialConvention => _initialConventionSet . ConfigurationConventions . Contains ( initialConvention ) ) ; existingConventionIndex = existingConventionIndex == - 1 ? _configurationConventions . Count : existingConventionIndex ; _configurationConventions . Insert ( existingConventionIndex , c ) ; } if ( ConventionsTypeFilter . IsConceptualModelConvention ( c . GetType ( ) ) ) { invalidType = false ; _conceptualModelConventions . Add ( c ) ; } if ( ConventionsTypeFilter . IsStoreModelConvention ( c . GetType ( ) ) ) { invalidType = false ; _storeModelConventions . Add ( c ) ; } if ( ConventionsTypeFilter . IsConceptualToStoreMappingConvention ( c . GetType ( ) ) ) { invalidType = false ; _conceptualToStoreMappingConventions . Add ( c ) ; } if ( invalidType ) { throw new InvalidOperationException ( Strings . ConventionsConfiguration_InvalidConventionType ( c . GetType ( ) ) ) ; } } }
Enables one or more conventions for the .
Enables one or more conventions for the .
conventions
The conventions to be enabled.
The conventions to be enabled .