コード例 #1
0
 public static RelationalPropertyBuilderAnnotations Relational(
     [NotNull] this InternalPropertyBuilder builder,
     ConfigurationSource configurationSource)
 => new RelationalPropertyBuilderAnnotations(builder, configurationSource, null);
コード例 #2
0
 /// <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 SqlServerPropertyBuilderAnnotations(
     [NotNull] InternalPropertyBuilder internalBuilder,
     ConfigurationSource configurationSource)
     : base(new RelationalAnnotationsBuilder(internalBuilder, configurationSource))
 {
 }
 public static RelationalPropertyBuilderAnnotations SqlCe(
     [NotNull] this InternalPropertyBuilder builder,
     ConfigurationSource configurationSource)
 => new RelationalPropertyBuilderAnnotations(builder, configurationSource, SqlCeAnnotationNames.Prefix);
コード例 #4
0
 /// <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 SqlServerPropertyBuilderAnnotations SqlServer(
     [NotNull] this InternalPropertyBuilder builder,
     ConfigurationSource configurationSource)
 => new SqlServerPropertyBuilderAnnotations(builder, configurationSource);
コード例 #5
0
        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 static MySqlPropertyBuilderAnnotations MySql(
     [NotNull] this InternalPropertyBuilder builder,
     ConfigurationSource configurationSource)
 => new MySqlPropertyBuilderAnnotations(builder, configurationSource);
コード例 #7
0
 /// <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 FbPropertyBuilderAnnotations Firebird(
     [NotNull] this InternalPropertyBuilder builder,
     ConfigurationSource configurationSource)
 => new FbPropertyBuilderAnnotations(builder, configurationSource);
コード例 #8
0
 public static AS400PropertyBuilderAnnotations AS400([NotNull] this InternalPropertyBuilder builder, ConfigurationSource configurationSource)
 => new AS400PropertyBuilderAnnotations(builder, configurationSource);
コード例 #9
0
 /// <summary>
 /// Sematic differences with <see cref="RelationalPropertyBuilderAnnotations" />
 /// </summary>
 /// <param name="propertyBuilder"></param>
 /// <param name="configurationSource"></param>
 /// <returns></returns>
 public CypherPropertyBuilderAnnotations(
     [NotNull] InternalPropertyBuilder propertyBuilder,
     ConfigurationSource configurationSource
     ) : base(new CypherAnnotationsBuilder(propertyBuilder, configurationSource))
 {
 }
 public static OraclePropertyBuilderAnnotations Oracle(
     [NotNull] this InternalPropertyBuilder builder,
     ConfigurationSource configurationSource)
 => new OraclePropertyBuilderAnnotations(builder, configurationSource);
コード例 #11
0
        /// <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 InternalPropertyBuilder Attach(
            [NotNull] InternalEntityTypeBuilder entityTypeBuilder, ConfigurationSource configurationSource)
        {
            var newProperty = Metadata.DeclaringEntityType.FindProperty(Metadata.Name);
            InternalPropertyBuilder newPropertyBuilder = null;

            if (newProperty != null &&
                newProperty.GetConfigurationSource().Overrides(configurationSource) &&
                ((Metadata.ClrType != null &&
                  Metadata.ClrType != newProperty.ClrType) ||
                 (Metadata.PropertyInfo != null &&
                  newProperty.PropertyInfo == null)))
            {
                newPropertyBuilder = newProperty.Builder;
            }
            else
            {
                newPropertyBuilder = Metadata.PropertyInfo == null
                    ? entityTypeBuilder.Property(Metadata.Name, Metadata.ClrType, configurationSource)
                    : entityTypeBuilder.Property(Metadata.PropertyInfo, configurationSource);
            }

            if (newProperty == Metadata)
            {
                return(newPropertyBuilder);
            }

            newPropertyBuilder.MergeAnnotationsFrom(this);

            var oldIsReadOnlyAfterSaveConfigurationSource = Metadata.GetIsReadOnlyAfterSaveConfigurationSource();

            if (oldIsReadOnlyAfterSaveConfigurationSource.HasValue)
            {
                newPropertyBuilder.ReadOnlyAfterSave(Metadata.IsReadOnlyAfterSave,
                                                     oldIsReadOnlyAfterSaveConfigurationSource.Value);
            }
            var oldIsReadOnlyBeforeSaveConfigurationSource = Metadata.GetIsReadOnlyBeforeSaveConfigurationSource();

            if (oldIsReadOnlyBeforeSaveConfigurationSource.HasValue)
            {
                newPropertyBuilder.ReadOnlyBeforeSave(Metadata.IsReadOnlyBeforeSave,
                                                      oldIsReadOnlyBeforeSaveConfigurationSource.Value);
            }
            var oldIsNullableConfigurationSource = Metadata.GetIsNullableConfigurationSource();

            if (oldIsNullableConfigurationSource.HasValue)
            {
                newPropertyBuilder.IsRequired(!Metadata.IsNullable, oldIsNullableConfigurationSource.Value);
            }
            var oldIsConcurrencyTokenConfigurationSource = Metadata.GetIsConcurrencyTokenConfigurationSource();

            if (oldIsConcurrencyTokenConfigurationSource.HasValue)
            {
                newPropertyBuilder.IsConcurrencyToken(Metadata.IsConcurrencyToken,
                                                      oldIsConcurrencyTokenConfigurationSource.Value);
            }
            var oldRequiresValueGeneratorConfigurationSource = Metadata.GetRequiresValueGeneratorConfigurationSource();

            if (oldRequiresValueGeneratorConfigurationSource.HasValue)
            {
                newPropertyBuilder.RequiresValueGenerator(Metadata.RequiresValueGenerator,
                                                          oldRequiresValueGeneratorConfigurationSource.Value);
            }
            var oldValueGeneratedConfigurationSource = Metadata.GetValueGeneratedConfigurationSource();

            if (oldValueGeneratedConfigurationSource.HasValue)
            {
                newPropertyBuilder.ValueGenerated(Metadata.ValueGenerated, oldValueGeneratedConfigurationSource.Value);
            }
            var oldIsStoreGeneratedAlwaysConfigurationSource = Metadata.GetIsStoreGeneratedAlwaysConfigurationSource();

            if (oldIsStoreGeneratedAlwaysConfigurationSource.HasValue)
            {
                newPropertyBuilder.IsStoreGeneratedAlways(Metadata.IsStoreGeneratedAlways, oldIsStoreGeneratedAlwaysConfigurationSource.Value);
            }
            var oldFieldInfoConfigurationSource = Metadata.GetFieldInfoConfigurationSource();

            if (oldFieldInfoConfigurationSource.HasValue)
            {
                newPropertyBuilder.HasFieldInfo(Metadata.FieldInfo, oldFieldInfoConfigurationSource.Value);
            }

            return(newPropertyBuilder);
        }