本文整理汇总了C#中ConfigurationSource类的典型用法代码示例。如果您正苦于以下问题:C# ConfigurationSource类的具体用法?C# ConfigurationSource怎么用?C# ConfigurationSource使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
ConfigurationSource类属于命名空间,在下文中一共展示了ConfigurationSource类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: RelationalEntityTypeBuilderAnnotations
public RelationalEntityTypeBuilderAnnotations(
[NotNull] InternalEntityTypeBuilder internalBuilder,
ConfigurationSource configurationSource,
[CanBeNull] string providerPrefix)
: base(new RelationalAnnotationsBuilder(internalBuilder, configurationSource, providerPrefix))
{
}
示例2: BuildUpConfiguration
internal override ConfigurationSource BuildUpConfiguration(ConfigurationSource previousSource)
{
this.Populate(previousSource);
this.FindSubscribers();
this.FindMessageFilters();
return this;
}
示例3: Annotation
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;
}
示例4: ForeignKey
/// <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);
}
示例5: Annotation
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;
}
示例6: RelationalForeignKeyBuilderAnnotations
public RelationalForeignKeyBuilderAnnotations(
[NotNull] InternalRelationshipBuilder internalBuilder,
ConfigurationSource configurationSource,
[CanBeNull] string providerPrefix)
: base(new RelationalAnnotationsBuilder(internalBuilder, configurationSource, providerPrefix))
{
}
示例7: Overrides
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;
}
示例8: RelationalEntityTypeBuilderAnnotations
public RelationalEntityTypeBuilderAnnotations(
[NotNull] InternalEntityTypeBuilder internalBuilder,
ConfigurationSource configurationSource,
[CanBeNull] RelationalFullAnnotationNames providerFullAnnotationNames)
: base(new RelationalAnnotationsBuilder(internalBuilder, configurationSource), providerFullAnnotationNames)
{
}
示例9: RelationalAnnotationsBuilder
/// <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;
}
示例10: CanSetAnnotation
/// <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;
}
示例11: Max
public static ConfigurationSource Max(this ConfigurationSource left, ConfigurationSource? right)
{
if (!right.HasValue
|| left.Overrides(right.Value))
{
return left;
}
return right.Value;
}
示例12: RelationalAnnotationsBuilder
public RelationalAnnotationsBuilder(
[NotNull] InternalMetadataBuilder internalBuilder,
ConfigurationSource configurationSource,
[CanBeNull] string providerPrefix)
: base(internalBuilder.Metadata, providerPrefix)
{
Check.NotNull(internalBuilder, nameof(internalBuilder));
EntityTypeBuilder = internalBuilder;
ConfigurationSource = configurationSource;
}
示例13: AddEntityType
/// <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);
}
示例14: Property
/// <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);
}
示例15: CombineParameters
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;
}