示例#1
0
 internal ConventionNavigationPropertyConfiguration(
     NavigationPropertyConfiguration configuration,
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
 {
     this._configuration      = configuration;
     this._modelConfiguration = modelConfiguration;
 }
示例#2
0
 internal ConventionTypeConfiguration(
     Type type,
     Func <ComplexTypeConfiguration> complexTypeConfiguration,
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
     : this(type, (Func <EntityTypeConfiguration>)null, complexTypeConfiguration, modelConfiguration)
 {
 }
示例#3
0
 internal ConventionTypeConfiguration(
     Type type,
     Func <ComplexTypeConfiguration> complexTypeConfiguration,
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
 {
     this._configuration = new ConventionTypeConfiguration(type, complexTypeConfiguration, modelConfiguration);
 }
示例#4
0
 private ModelConfiguration(System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration source)
 {
     source._entityConfigurations.Each <KeyValuePair <Type, EntityTypeConfiguration> >((Action <KeyValuePair <Type, EntityTypeConfiguration> >)(c => this._entityConfigurations.Add(c.Key, c.Value.Clone())));
     source._complexTypeConfigurations.Each <KeyValuePair <Type, ComplexTypeConfiguration> >((Action <KeyValuePair <Type, ComplexTypeConfiguration> >)(c => this._complexTypeConfigurations.Add(c.Key, c.Value.Clone())));
     this._ignoredTypes.AddRange <Type>((IEnumerable <Type>)source._ignoredTypes);
     this.DefaultSchema  = source.DefaultSchema;
     this.ModelNamespace = source.ModelNamespace;
 }
示例#5
0
 public void Apply(Type memberInfo, System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
 {
     if (!this._predicates.All <Func <Type, bool> >((Func <Func <Type, bool>, bool>)(p => p(memberInfo))))
     {
         return;
     }
     this.ApplyCore(memberInfo, modelConfiguration);
 }
示例#6
0
 internal virtual void ApplyModelConfiguration(Type type, System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
 {
     for (int index = this._configurationConventions.Count - 1; index >= 0; --index)
     {
         IConvention configurationConvention = this._configurationConventions[index];
         (configurationConvention as IConfigurationConvention <Type>)?.Apply(type, modelConfiguration);
         (configurationConvention as Convention)?.ApplyModelConfiguration(type, modelConfiguration);
     }
 }
示例#7
0
        protected override void ApplyCore(Type memberInfo, System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
        {
            T obj = this._capturingPredicate(memberInfo);

            if ((object)obj == null)
            {
                return;
            }
            this.InvokeAction(memberInfo, modelConfiguration, obj);
        }
示例#8
0
 internal virtual void ApplyPropertyConfiguration(
     PropertyInfo propertyInfo,
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
 {
     for (int index = this._configurationConventions.Count - 1; index >= 0; --index)
     {
         IConvention configurationConvention = this._configurationConventions[index];
         (configurationConvention as IConfigurationConvention <PropertyInfo>)?.Apply(propertyInfo, modelConfiguration);
         (configurationConvention as Convention)?.ApplyPropertyConfiguration(propertyInfo, modelConfiguration);
     }
 }
示例#9
0
 private ConventionTypeConfiguration(
     Type type,
     Func <EntityTypeConfiguration> entityTypeConfiguration,
     Func <ComplexTypeConfiguration> complexTypeConfiguration,
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
 {
     this._type = type;
     this._entityTypeConfiguration  = entityTypeConfiguration;
     this._complexTypeConfiguration = complexTypeConfiguration;
     this._modelConfiguration       = modelConfiguration;
 }
示例#10
0
 public void Apply(
     PropertyInfo memberInfo,
     Func <System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration> configuration,
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
 {
     if (!this._predicates.All <Func <PropertyInfo, bool> >((Func <Func <PropertyInfo, bool>, bool>)(p => p(memberInfo))))
     {
         return;
     }
     this.ApplyCore(memberInfo, configuration, modelConfiguration);
 }
示例#11
0
        internal virtual void ApplyPropertyConfiguration(
            PropertyInfo propertyInfo,
            Func <PropertyConfiguration> propertyConfiguration,
            System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
        {
            Type configurationType = StructuralTypeConfiguration.GetPropertyConfigurationType(propertyInfo.PropertyType);

            for (int index = this._configurationConventions.Count - 1; index >= 0; --index)
            {
                IConvention configurationConvention = this._configurationConventions[index];
                new ConventionsConfiguration.PropertyConfigurationConventionDispatcher(configurationConvention, configurationType, propertyInfo, propertyConfiguration, modelConfiguration).Dispatch();
                (configurationConvention as Convention)?.ApplyPropertyConfiguration(propertyInfo, propertyConfiguration, modelConfiguration);
            }
        }
示例#12
0
 internal virtual void ApplyPropertyTypeConfiguration <TStructuralTypeConfiguration>(
     PropertyInfo propertyInfo,
     Func <TStructuralTypeConfiguration> structuralTypeConfiguration,
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
     where TStructuralTypeConfiguration : StructuralTypeConfiguration
 {
     for (int index = this._configurationConventions.Count - 1; index >= 0; --index)
     {
         IConvention configurationConvention = this._configurationConventions[index];
         (configurationConvention as IConfigurationConvention <PropertyInfo, TStructuralTypeConfiguration>)?.Apply(propertyInfo, structuralTypeConfiguration, modelConfiguration);
         (configurationConvention as IConfigurationConvention <PropertyInfo, StructuralTypeConfiguration>)?.Apply(propertyInfo, (Func <StructuralTypeConfiguration>)structuralTypeConfiguration, modelConfiguration);
         (configurationConvention as Convention)?.ApplyPropertyTypeConfiguration <TStructuralTypeConfiguration>(propertyInfo, structuralTypeConfiguration, modelConfiguration);
     }
 }
示例#13
0
 public virtual void AddConfigurationTypesToModel(
     IEnumerable <Type> types,
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
 {
     foreach (Type type in types)
     {
         if (this._filter.IsEntityTypeConfiguration(type))
         {
             modelConfiguration.Add(this._activator.Activate <EntityTypeConfiguration>(type));
         }
         else if (this._filter.IsComplexTypeConfiguration(type))
         {
             modelConfiguration.Add(this._activator.Activate <ComplexTypeConfiguration>(type));
         }
     }
 }
示例#14
0
        internal override void ApplyPropertyTypeConfiguration <TStructuralTypeConfiguration>(
            PropertyInfo propertyInfo,
            Func <TStructuralTypeConfiguration> structuralTypeConfiguration,
            System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
        {
            if (!(typeof(TStructuralTypeConfiguration) == typeof(EntityTypeConfiguration)) || !this._attributeProvider.GetAttributes(propertyInfo).OfType <KeyAttribute>().Any <KeyAttribute>())
            {
                return;
            }
            EntityTypeConfiguration typeConfiguration = (EntityTypeConfiguration)(object)structuralTypeConfiguration();

            if (!propertyInfo.IsValidEdmScalarProperty())
            {
                return;
            }
            typeConfiguration.Key(propertyInfo);
        }
示例#15
0
        internal override void ApplyPropertyConfiguration(
            PropertyInfo propertyInfo,
            Func <PropertyConfiguration> propertyConfiguration,
            System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
        {
            if (!propertyInfo.IsValidEdmNavigationProperty() || propertyInfo.PropertyType.IsCollection() || !this._attributeProvider.GetAttributes(propertyInfo).OfType <RequiredAttribute>().Any <RequiredAttribute>())
            {
                return;
            }
            NavigationPropertyConfiguration propertyConfiguration1 = (NavigationPropertyConfiguration)propertyConfiguration();

            if (propertyConfiguration1.RelationshipMultiplicity.HasValue)
            {
                return;
            }
            propertyConfiguration1.RelationshipMultiplicity = new RelationshipMultiplicity?(RelationshipMultiplicity.One);
        }
示例#16
0
 public PropertyConfigurationConventionDispatcher(
     IConvention convention,
     Type propertyConfigurationType,
     PropertyInfo propertyInfo,
     Func <PropertyConfiguration> propertyConfiguration,
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
 {
     Check.NotNull <IConvention>(convention, nameof(convention));
     Check.NotNull <Type>(propertyConfigurationType, nameof(propertyConfigurationType));
     Check.NotNull <PropertyInfo>(propertyInfo, nameof(propertyInfo));
     Check.NotNull <Func <PropertyConfiguration> >(propertyConfiguration, nameof(propertyConfiguration));
     this._convention = convention;
     this._propertyConfigurationType = propertyConfigurationType;
     this._propertyInfo          = propertyInfo;
     this._propertyConfiguration = propertyConfiguration;
     this._modelConfiguration    = modelConfiguration;
 }
示例#17
0
 internal ConfigurationRegistrar(System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
 {
     this._modelConfiguration = modelConfiguration;
 }
示例#18
0
 internal ConventionTypeConfiguration(Type type, System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
 {
     this._configuration = new ConventionTypeConfiguration(type, modelConfiguration);
 }
示例#19
0
 internal virtual void Apply(System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
 {
     Check.NotNull <System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration>(modelConfiguration, nameof(modelConfiguration));
     EdmMetadataContext.ConfigureEdmMetadata(modelConfiguration);
 }
示例#20
0
 public static void ConfigureEdmMetadata(System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
 {
     modelConfiguration.Entity(typeof(EdmMetadata)).ToTable("EdmMetadata");
 }
示例#21
0
 internal override void ApplyModelConfiguration(System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration)
 {
     base.ApplyModelConfiguration(modelConfiguration);
     modelConfiguration.ModelNamespace = this._modelNamespace;
 }
示例#22
0
 protected abstract void InvokeAction(
     Type memberInfo,
     Func <ComplexTypeConfiguration> configuration,
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration,
     T value);
示例#23
0
 protected abstract void ApplyCore(
     Type memberInfo,
     Func <ComplexTypeConfiguration> configuration,
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration);
示例#24
0
 protected abstract void ApplyCore(Type memberInfo, System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration);
示例#25
0
 protected abstract void ApplyCore(
     PropertyInfo memberInfo,
     Func <System.Data.Entity.ModelConfiguration.Configuration.Properties.Primitive.PrimitivePropertyConfiguration> configuration,
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration modelConfiguration);
示例#26
0
 protected abstract void InvokeAction(
     Type memberInfo,
     System.Data.Entity.ModelConfiguration.Configuration.ModelConfiguration configuration,
     T value);