internal override ConfigurationSource BuildUpConfiguration(ConfigurationSource previousSource) { this.Populate(previousSource); this.FindSubscribers(); this.FindMessageFilters(); return this; }
public static bool Overrides(this ConfigurationSource newConfigurationSource, ConfigurationSource? oldConfigurationSource) { if (oldConfigurationSource == null) { return true; } if (newConfigurationSource == ConfigurationSource.Explicit) { return true; } if (oldConfigurationSource == ConfigurationSource.Explicit) { return false; } if (newConfigurationSource == ConfigurationSource.DataAnnotation) { return true; } if (oldConfigurationSource == ConfigurationSource.DataAnnotation) { return false; } return true; }
public virtual bool Annotation( [NotNull] string annotation, [CanBeNull] object value, ConfigurationSource configurationSource) { var existingValue = Metadata[annotation]; if (existingValue != null) { ConfigurationSource existingConfigurationSource; if (!_annotationSources.Value.TryGetValue(annotation, out existingConfigurationSource)) { existingConfigurationSource = ConfigurationSource.Explicit; } if ((value == null || existingValue != value) && !configurationSource.Overrides(existingConfigurationSource)) { return false; } configurationSource = configurationSource.Max(existingConfigurationSource); } if (value != null) { _annotationSources.Value[annotation] = configurationSource; Metadata[annotation] = value; } else { _annotationSources.Value.Remove(annotation); Metadata.RemoveAnnotation(new Annotation(annotation, "_")); } return true; }
public RelationalEntityTypeBuilderAnnotations( [NotNull] InternalEntityTypeBuilder internalBuilder, ConfigurationSource configurationSource, [CanBeNull] RelationalFullAnnotationNames providerFullAnnotationNames) : base(new RelationalAnnotationsBuilder(internalBuilder, configurationSource), providerFullAnnotationNames) { }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public ForeignKey( [NotNull] IReadOnlyList<Property> dependentProperties, [NotNull] Key principalKey, [NotNull] EntityType dependentEntityType, [NotNull] EntityType principalEntityType, ConfigurationSource configurationSource) { Check.NotEmpty(dependentProperties, nameof(dependentProperties)); Check.HasNoNulls(dependentProperties, nameof(dependentProperties)); Check.NotNull(principalKey, nameof(principalKey)); Check.NotNull(principalEntityType, nameof(principalEntityType)); Properties = dependentProperties; PrincipalKey = principalKey; DeclaringEntityType = dependentEntityType; PrincipalEntityType = principalEntityType; _configurationSource = configurationSource; AreCompatible(principalKey.Properties, dependentProperties, principalEntityType, dependentEntityType, shouldThrow: true); if (!principalEntityType.GetKeys().Contains(principalKey)) { throw new InvalidOperationException( CoreStrings.ForeignKeyReferencedEntityKeyMismatch( Property.Format(principalKey.Properties), principalEntityType)); } Builder = new InternalRelationshipBuilder(this, dependentEntityType.Model.Builder); }
private bool Annotation( string annotation, object value, ConfigurationSource configurationSource, bool canOverrideSameSource) { var existingValue = Metadata[annotation]; if (existingValue != null) { ConfigurationSource existingConfigurationSource; if (!_annotationSources.Value.TryGetValue(annotation, out existingConfigurationSource)) { existingConfigurationSource = ConfigurationSource.Explicit; } if ((value == null || !existingValue.Equals(value)) && (!configurationSource.Overrides(existingConfigurationSource) || configurationSource == existingConfigurationSource && !canOverrideSameSource)) { return false; } configurationSource = configurationSource.Max(existingConfigurationSource); } if (value != null) { _annotationSources.Value[annotation] = configurationSource; Metadata[annotation] = value; } else { _annotationSources.Value.Remove(annotation); Metadata.RemoveAnnotation(new Annotation(annotation, "_")); } return true; }
public RelationalForeignKeyBuilderAnnotations( [NotNull] InternalRelationshipBuilder internalBuilder, ConfigurationSource configurationSource, [CanBeNull] string providerPrefix) : base(new RelationalAnnotationsBuilder(internalBuilder, configurationSource, providerPrefix)) { }
public RelationalEntityTypeBuilderAnnotations( [NotNull] InternalEntityTypeBuilder internalBuilder, ConfigurationSource configurationSource, [CanBeNull] string providerPrefix) : base(new RelationalAnnotationsBuilder(internalBuilder, configurationSource, providerPrefix)) { }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual bool CanSetAnnotation([NotNull] string name, [CanBeNull] object value, ConfigurationSource configurationSource) { var existingAnnotation = Metadata.FindAnnotation(name); if (existingAnnotation != null) { return CanSetAnnotationValue(existingAnnotation, value, configurationSource, canOverrideSameSource: true); } return true; }
public static ConfigurationSource Max(this ConfigurationSource left, ConfigurationSource? right) { if (!right.HasValue || left.Overrides(right.Value)) { return left; } return right.Value; }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public RelationalAnnotationsBuilder( [NotNull] InternalMetadataBuilder internalBuilder, ConfigurationSource configurationSource) : base(internalBuilder.Metadata) { Check.NotNull(internalBuilder, nameof(internalBuilder)); MetadataBuilder = internalBuilder; ConfigurationSource = configurationSource; }
public RelationalAnnotationsBuilder( [NotNull] InternalMetadataBuilder internalBuilder, ConfigurationSource configurationSource, [CanBeNull] string providerPrefix) : base(internalBuilder.Metadata, providerPrefix) { Check.NotNull(internalBuilder, nameof(internalBuilder)); EntityTypeBuilder = internalBuilder; ConfigurationSource = configurationSource; }
private EntityType AddEntityTypeWithoutConventions(string name, ConfigurationSource configurationSource) { var entityType = new MaterializingEntityType(name, this, configurationSource); var previousLength = _entityTypes.Count; _entityTypes[name] = entityType; if (previousLength == _entityTypes.Count) { throw new InvalidOperationException(CoreStrings.DuplicateEntityType(entityType.Name)); } return entityType; }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public Property( [NotNull] PropertyInfo propertyInfo, [NotNull] EntityType declaringEntityType, ConfigurationSource configurationSource) : base(Check.NotNull(propertyInfo, nameof(propertyInfo)).Name, propertyInfo) { Check.NotNull(declaringEntityType, nameof(declaringEntityType)); DeclaringEntityType = declaringEntityType; ClrType = propertyInfo.PropertyType; Initialize(declaringEntityType, configurationSource); }
private static Dictionary<string, string> CombineParameters(ConfigurationSource source, string resource, Dictionary<string, string> parameters) { if (source == ConfigurationSource.Xml || resource.IndexOf('?') <= 0) return parameters; if (parameters == null) { parameters = new Dictionary<string, string>(StringComparer.OrdinalIgnoreCase); } foreach (var pair in Common.ParseQueryString(resource.Substring(resource.IndexOf('?')))) { parameters[pair.Key] = pair.Value; } return parameters; }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual EntityType AddEntityType( [NotNull] string name, // ReSharper disable once MethodOverloadWithOptionalParameter ConfigurationSource configurationSource = ConfigurationSource.Explicit, bool runConventions = true) { Check.NotEmpty(name, nameof(name)); var entityType = new EntityType(name, this, configurationSource); return AddEntityType(entityType, runConventions); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public Property( [NotNull] string name, [NotNull] Type clrType, [NotNull] EntityType declaringEntityType, ConfigurationSource configurationSource) : base(name, null) { Check.NotNull(clrType, nameof(clrType)); Check.NotNull(declaringEntityType, nameof(declaringEntityType)); DeclaringEntityType = declaringEntityType; ClrType = clrType; Initialize(declaringEntityType, configurationSource); }
public static bool CanSet(this ConfigurationSource newConfigurationSource, ConfigurationSource? oldConfigurationSource, bool isValueSet) { if (isValueSet) { var existingConfigurationSource = oldConfigurationSource ?? ConfigurationSource.Explicit; if (!newConfigurationSource.Overrides(existingConfigurationSource)) { return false; } } return true; }
public Index( [NotNull] IReadOnlyList<Property> properties, [NotNull] EntityType declaringEntityType, ConfigurationSource configurationSource) { Check.NotEmpty(properties, nameof(properties)); Check.HasNoNulls(properties, nameof(properties)); Check.NotNull(declaringEntityType, nameof(declaringEntityType)); Properties = properties; DeclaringEntityType = declaringEntityType; _configurationSource = configurationSource; Builder = new InternalIndexBuilder(this, declaringEntityType.Model.Builder); }
private bool HasAnnotation( string name, object value, ConfigurationSource configurationSource, bool canOverrideSameSource) { var existingAnnotation = Metadata.FindAnnotation(name); if (existingAnnotation != null) { if (existingAnnotation.Value.Equals(value)) { existingAnnotation.UpdateConfigurationSource(configurationSource); return true; } var existingConfigurationSource = existingAnnotation.GetConfigurationSource(); if (!configurationSource.Overrides(existingConfigurationSource) || (configurationSource == existingConfigurationSource && !canOverrideSameSource)) { return false; } if (value == null) { var removed = Metadata.RemoveAnnotation(name); Debug.Assert(removed == existingAnnotation); } else { Metadata.SetAnnotation(name, value, configurationSource); } return true; } if (value != null) { Metadata.AddAnnotation(name, value, configurationSource); } return true; }
private void UpdateIsStoreGeneratedAlwaysConfigurationSource(ConfigurationSource configurationSource) => _isStoreGeneratedAlwaysConfigurationSource = configurationSource.Max(_isStoreGeneratedAlwaysConfigurationSource);
private void UpdateFieldInfoConfigurationSource(ConfigurationSource configurationSource) => _fieldInfoConfigurationSource = configurationSource.Max(_fieldInfoConfigurationSource);
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public static RelationalForeignKeyBuilderAnnotations Relational( [NotNull] this InternalRelationshipBuilder builder, ConfigurationSource configurationSource) => new RelationalForeignKeyBuilderAnnotations(builder, configurationSource, null);
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual InternalEntityTypeBuilder Entity( [NotNull] Type type, ConfigurationSource configurationSource, bool?shouldBeOwned = false) => Entity(new TypeIdentity(type, Metadata), configurationSource, shouldBeOwned);
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual bool CanSetTypeMapping([CanBeNull] RelationalTypeMapping typeMapping, ConfigurationSource configurationSource) => configurationSource.Overrides(Metadata.GetTypeMappingConfigurationSource()) || Metadata.TypeMapping == typeMapping;
public FakeNavigationBase(string name, ConfigurationSource configurationSource, EntityType entityType) : base(name, null, null, configurationSource) { DeclaringType = entityType; }
public virtual ConfigurationSource UpdateConfigurationSource([NotNull] TKey key, ConfigurationSource configurationSource) => GetTuple(key, configurationSource).Item2;
private InternalPropertyBuilder InternalProperty(Type propertyType, string propertyName, bool shadowProperty, ConfigurationSource configurationSource) { if (CanAdd(propertyName, isNavigation: false, configurationSource: configurationSource)) { if (_ignoredProperties.HasValue) { _ignoredProperties.Value.Remove(propertyName); } return(_propertyBuilders.GetOrAdd( () => Metadata.FindProperty(propertyName), () => Metadata.AddProperty(propertyName, propertyType, shadowProperty), property => new InternalPropertyBuilder(property, ModelBuilder, configurationSource), ModelBuilder.ConventionDispatcher.OnPropertyAdded, configurationSource)); } return(null); }
public virtual InternalPropertyBuilder Property([NotNull] PropertyInfo clrProperty, ConfigurationSource configurationSource) { Check.NotNull(clrProperty, nameof(clrProperty)); return(InternalProperty(clrProperty.PropertyType, clrProperty.Name, /*shadowProperty:*/ false, configurationSource)); }
public virtual InternalKeyBuilder Key([CanBeNull] IReadOnlyList <Property> properties, ConfigurationSource configurationSource) { if (properties == null || !properties.Any()) { return(null); } foreach (var property in properties) { _propertyBuilders.UpdateConfigurationSource(property, configurationSource); } return(_keyBuilders.GetOrAdd( () => Metadata.FindKey(properties), () => Metadata.AddKey(properties), key => new InternalKeyBuilder(key, ModelBuilder), ModelBuilder.ConventionDispatcher.OnKeyAdded, configurationSource)); }
public virtual InternalKeyBuilder Key([NotNull] IReadOnlyList <string> propertyNames, ConfigurationSource configurationSource) { Check.NotEmpty(propertyNames, nameof(propertyNames)); return(Key(GetOrCreateProperties(propertyNames, configurationSource), configurationSource)); }
public virtual IReadOnlyList <Property> GetOrCreateProperties([CanBeNull] IEnumerable <PropertyInfo> clrProperties, ConfigurationSource configurationSource) { if (clrProperties == null) { return(null); } var list = new List <Property>(); foreach (var propertyInfo in clrProperties) { var propertyBuilder = Property(propertyInfo, configurationSource); if (propertyBuilder == null) { return(null); } list.Add(propertyBuilder.Metadata); } return(list); }
public virtual IReadOnlyList <Property> GetOrCreateProperties([CanBeNull] IEnumerable <string> propertyNames, ConfigurationSource configurationSource) { if (propertyNames == null) { return(null); } var list = new List <Property>(); foreach (var propertyName in propertyNames) { var property = Metadata.FindProperty(propertyName); if (property == null) { if (Metadata.ClrType == null) { throw new ModelItemNotFoundException(Strings.PropertyNotFound(propertyName, Metadata.Name)); } var clrProperty = Metadata.ClrType.GetPropertiesInHierarchy(propertyName).FirstOrDefault(); if (clrProperty == null) { throw new InvalidOperationException(Strings.NoClrProperty(propertyName, Metadata.Name)); } var propertyBuilder = Property(clrProperty, configurationSource); if (propertyBuilder == null) { return(null); } property = propertyBuilder.Metadata; } else { InternalProperty(property.ClrType, property.Name, property.IsShadowProperty, configurationSource); } list.Add(property); } return(list); }
private void Initialize(EntityType declaringEntityType, ConfigurationSource configurationSource) { _configurationSource = configurationSource; Builder = new InternalPropertyBuilder(this, declaringEntityType.Model.Builder); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual ConventionalAnnotation SetAnnotation( [NotNull] string name, [NotNull] object value, ConfigurationSource configurationSource) => (ConventionalAnnotation)base.SetAnnotation(name, CreateAnnotation(name, value, configurationSource));
public virtual InternalKeyBuilder PrimaryKey([NotNull] IReadOnlyList <PropertyInfo> clrProperties, ConfigurationSource configurationSource) { Check.NotEmpty(clrProperties, nameof(clrProperties)); return(PrimaryKey(GetOrCreateProperties(clrProperties, configurationSource), configurationSource)); }
private ForeignKey CreateForeignKey( [NotNull] InternalEntityTypeBuilder principalEntityTypeBuilder, [NotNull] InternalEntityTypeBuilder dependentEntityTypeBuilder, [CanBeNull] string navigationToPrincipal, [CanBeNull] IReadOnlyList <Property> foreignKeyProperties, [CanBeNull] IReadOnlyList <Property> principalProperties, bool?isUnique, bool?isRequired, ConfigurationSource configurationSource) { var principalType = principalEntityTypeBuilder.Metadata; var dependentType = dependentEntityTypeBuilder.Metadata; if (foreignKeyProperties != null && dependentType.FindForeignKey(foreignKeyProperties) != null) { return(null); } if (foreignKeyProperties != null && principalProperties != null) { Entity.Metadata.Property.EnsureCompatible(principalProperties, foreignKeyProperties); } Key principalKey; if (principalProperties != null) { var keyBuilder = principalEntityTypeBuilder.Key(principalProperties, configurationSource); if (keyBuilder == null) { return(null); } principalKey = keyBuilder.Metadata; } else { principalKey = principalType.FindPrimaryKey(); } if (foreignKeyProperties != null) { if (principalKey == null || !Entity.Metadata.Property.AreCompatible(principalKey.Properties, foreignKeyProperties)) { var principalKeyProperties = new Property[foreignKeyProperties.Count]; for (var i = 0; i < foreignKeyProperties.Count; i++) { var foreignKeyProperty = foreignKeyProperties[i]; principalKeyProperties[i] = CreateUniqueProperty( foreignKeyProperty.Name, foreignKeyProperty.ClrType, principalEntityTypeBuilder, isRequired); } var keyBuilder = principalEntityTypeBuilder.Key(principalKeyProperties, ConfigurationSource.Convention); principalKey = keyBuilder.Metadata; } } else { var baseName = (string.IsNullOrEmpty(navigationToPrincipal) ? principalType.DisplayName() : navigationToPrincipal); if (principalKey == null) { var principalKeyProperty = CreateUniqueProperty( "TempId", typeof(int), principalEntityTypeBuilder, isRequired); principalKey = principalEntityTypeBuilder.Key(new[] { principalKeyProperty }, ConfigurationSource.Convention).Metadata; } var fkProperties = new Property[principalKey.Properties.Count]; for (var i = 0; i < principalKey.Properties.Count; i++) { var keyProperty = principalKey.Properties[i]; fkProperties[i] = CreateUniqueProperty( baseName + keyProperty.Name, keyProperty.ClrType.MakeNullable(), dependentEntityTypeBuilder, isRequired); } foreignKeyProperties = fkProperties; } var newForeignKey = dependentType.AddForeignKey(foreignKeyProperties, principalKey); newForeignKey.IsUnique = isUnique; foreach (var foreignKeyProperty in foreignKeyProperties) { dependentEntityTypeBuilder.Property(foreignKeyProperty.ClrType, foreignKeyProperty.Name, ConfigurationSource.Convention) .GenerateValueOnAdd(false, ConfigurationSource.Convention); } return(newForeignKey); }
public virtual void UpdateConfigurationSource(ConfigurationSource configurationSource) => _configurationSource = _configurationSource.Max(configurationSource);
internal Entity(Type type, ConfigurationSource configurationSource) : base(type, configurationSource) { }
private void UpdateIsUniqueConfigurationSource(ConfigurationSource configurationSource) => _isUniqueConfigurationSource = configurationSource.Max(_isUniqueConfigurationSource);
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual bool CanSetStoreType([CanBeNull] string storeType, ConfigurationSource configurationSource) => configurationSource.Overrides(Metadata.GetStoreTypeConfigurationSource()) || Metadata.StoreType == storeType;
public virtual TValue TryGetValue([NotNull] TKey key, ConfigurationSource configurationSource) => GetTuple(key, configurationSource).Item1;
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public virtual InternalEntityTypeBuilder Entity( [NotNull] string name, ConfigurationSource configurationSource, bool?shouldBeOwned = false) => Entity(new TypeIdentity(name), configurationSource, shouldBeOwned);
public ConfigurationSourceAttribute(ConfigurationSource configurationSource) { ConfigurationSource = configurationSource; }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public static RelationalIndexBuilderAnnotations Relational( [NotNull] this InternalIndexBuilder builder, ConfigurationSource configurationSource) => new RelationalIndexBuilderAnnotations(builder, configurationSource, null);
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public new virtual InternalNavigationBuilder?UsePropertyAccessMode( PropertyAccessMode?propertyAccessMode, ConfigurationSource configurationSource) => (InternalNavigationBuilder?)base.UsePropertyAccessMode(propertyAccessMode, configurationSource);
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public virtual void SetIsStoreGeneratedAlways(bool storeGeneratedAlways, ConfigurationSource configurationSource) { if (IsStoreGeneratedAlways != storeGeneratedAlways) { SetFlag(storeGeneratedAlways, PropertyFlags.StoreGeneratedAlways); DeclaringEntityType.PropertyMetadataChanged(); } UpdateIsStoreGeneratedAlwaysConfigurationSource(configurationSource); }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public new virtual InternalNavigationBuilder?HasField(FieldInfo?fieldInfo, ConfigurationSource configurationSource) => (InternalNavigationBuilder?)base.HasField(fieldInfo, configurationSource);
public OracleKeyBuilderAnnotations( [NotNull] InternalKeyBuilder internalBuilder, ConfigurationSource configurationSource) : base(new RelationalAnnotationsBuilder(internalBuilder, configurationSource)) { }
/// <summary> /// This is an internal API that supports the Entity Framework Core infrastructure and not subject to /// the same compatibility standards as public APIs. It may be changed or removed without notice in /// any release. You should only use it directly in your code with extreme caution and knowing that /// doing so can result in application failures when updating to a new Entity Framework Core release. /// </summary> public new virtual InternalNavigationBuilder?HasField(string?fieldName, ConfigurationSource configurationSource) => (InternalNavigationBuilder?)base.HasField(fieldName, configurationSource);
public SqlServerModelBuilderAnnotations( [NotNull] InternalModelBuilder internalBuilder, ConfigurationSource configurationSource) : base(new RelationalAnnotationsBuilder(internalBuilder, configurationSource, SqlServerAnnotationNames.Prefix)) { }
/// <summary> /// Returns a value indicating whether the configuration source always takes precedence over the other configuration source. /// </summary> /// <remarks> /// See <see href="https://aka.ms/efcore-docs-conventions">Model building conventions</see> for more information and examples. /// </remarks> /// <param name="newConfigurationSource">The new configuration source.</param> /// <param name="oldConfigurationSource">The old configuration source.</param> /// <returns><see langword="true" /> if the configuration source always takes precedence over the other configuration source.</returns> public static bool OverridesStrictly(this ConfigurationSource newConfigurationSource, ConfigurationSource?oldConfigurationSource) => newConfigurationSource.Overrides(oldConfigurationSource) && newConfigurationSource != oldConfigurationSource;
private static ConventionalAnnotation CreateAnnotation( string name, object value, ConfigurationSource configurationSource) => new ConventionalAnnotation(name, value, configurationSource);
/// <summary> /// Returns the configuration source which has higher priority. /// </summary> /// <remarks> /// See <see href="https://aka.ms/efcore-docs-conventions">Model building conventions</see> for more information and examples. /// </remarks> /// <param name="left">The left configuration source.</param> /// <param name="right">The right configuration source.</param> /// <returns>The configuration source with higher priority.</returns> public static ConfigurationSource Max(this ConfigurationSource left, ConfigurationSource?right) => left.Overrides(right) ? left : right !.Value;
private InternalRelationshipBuilder ForeignKey(EntityType principalType, IReadOnlyList <Property> dependentProperties, ConfigurationSource configurationSource) { return(dependentProperties == null ? null : Relationship(principalType, Metadata, null, null, configurationSource, false) ?.ForeignKey(dependentProperties, configurationSource)); }
/// <summary> /// This API supports the Entity Framework Core infrastructure and is not intended to be used /// directly from your code. This API may change or be removed in future releases. /// </summary> public SqlServerIndexBuilderAnnotations( [NotNull] InternalIndexBuilder internalBuilder, ConfigurationSource configurationSource) : base(new RelationalAnnotationsBuilder(internalBuilder, configurationSource)) { }
public virtual void SetIsUnique(bool unique, ConfigurationSource configurationSource) { _isUnique = unique; UpdateIsUniqueConfigurationSource(configurationSource); }
private RelationshipSnapshot DetachRelationship([NotNull] ForeignKey foreignKey, ConfigurationSource configurationSource) { var navigationToPrincipalName = foreignKey.GetNavigationToPrincipal()?.Name; var navigationToDependentName = foreignKey.GetNavigationToDependent()?.Name; var relationship = Relationship(foreignKey, true, ConfigurationSource.Convention); var relationshipConfigurationSource = RemoveRelationship(foreignKey, configurationSource); if (relationshipConfigurationSource == null) { return(null); } return(new RelationshipSnapshot(relationship, navigationToPrincipalName, navigationToDependentName, relationshipConfigurationSource.Value)); }
public MaterializingEntityType(string name, Model model, ConfigurationSource configurationSource) : base(name, model, configurationSource) { }
public virtual TValue GetOrAdd( [NotNull] Func <TKey> getKey, [NotNull] Func <TKey> createKey, [NotNull] Func <TKey, TValue> createValue, ConfigurationSource configurationSource) => GetOrAdd(getKey, createKey, createValue, null, null, configurationSource);