Ejemplo n.º 1
0
        public void Can_only_override_existing_ClrType_value_explicitly()
        {
            var model = new Model();

            model.AddEntityType(typeof(Customer)).AddProperty(Customer.NameProperty.Name);
            var modelBuilder  = new InternalModelBuilder(model);
            var entityBuilder = modelBuilder.Entity(typeof(Customer), ConfigurationSource.Explicit);
            var builder       = entityBuilder.Property(Customer.NameProperty.Name, ConfigurationSource.Convention);

            Assert.Null(builder.Metadata.GetClrTypeConfigurationSource());

            builder.Metadata.ClrType = typeof(string);

            Assert.Equal(ConfigurationSource.Explicit, builder.Metadata.GetClrTypeConfigurationSource());
            Assert.True(builder.HasClrType(typeof(string), ConfigurationSource.DataAnnotation));
            Assert.False(builder.HasClrType(typeof(int), ConfigurationSource.DataAnnotation));

            Assert.Equal(typeof(string), builder.Metadata.ClrType);

            Assert.True(builder.HasClrType(typeof(int), ConfigurationSource.Explicit));
            Assert.Equal(typeof(int), builder.Metadata.ClrType);
        }
Ejemplo n.º 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 static SqlServerModelBuilderAnnotations SqlServer(
     [NotNull] this InternalModelBuilder builder,
     ConfigurationSource configurationSource)
 => new SqlServerModelBuilderAnnotations(builder, configurationSource);
Ejemplo n.º 3
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 RelationalModelBuilderAnnotations(
     [NotNull] InternalModelBuilder internalBuilder,
     ConfigurationSource configurationSource)
     : base(new RelationalAnnotationsBuilder(internalBuilder, configurationSource))
 {
 }
 public static RelationalModelBuilderAnnotations SqlCe(
     [NotNull] this InternalModelBuilder builder,
     ConfigurationSource configurationSource)
 => new RelationalModelBuilderAnnotations(builder, configurationSource, SqlCeAnnotationNames.Prefix);
 public static OracleModelBuilderAnnotations Oracle(
     [NotNull] this InternalModelBuilder builder,
     ConfigurationSource configurationSource)
 => new OracleModelBuilderAnnotations(builder, configurationSource);
Ejemplo n.º 6
0
 public static RelationalModelBuilderAnnotations MyCat(
     [NotNull] this InternalModelBuilder builder,
     ConfigurationSource configurationSource)
 => new RelationalModelBuilderAnnotations(builder, configurationSource, MyCatFullAnnotationNames.Instance);
 /// <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 InternalSkipNavigationBuilder([NotNull] SkipNavigation metadata, [NotNull] InternalModelBuilder modelBuilder)
     : base(metadata, modelBuilder)
 {
 }
 /// <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 InternalKeyBuilder([NotNull] Key key, [NotNull] InternalModelBuilder modelBuilder)
     : base(key, modelBuilder)
 {
 }
Ejemplo n.º 9
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 FbModelBuilderAnnotations Firebird(
     [NotNull] this InternalModelBuilder builder,
     ConfigurationSource configurationSource)
 => new FbModelBuilderAnnotations(builder, configurationSource);
Ejemplo n.º 10
0
 /// <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 InternalNavigationBuilder(Navigation metadata, InternalModelBuilder modelBuilder)
     : base(metadata, modelBuilder)
 {
 }
Ejemplo n.º 11
0
 public Model([NotNull] ConventionSet conventions)
 {
     ConventionDispatcher = new ConventionDispatcher(conventions);
     Builder = new InternalModelBuilder(this);
     ConventionDispatcher.OnModelInitialized(Builder);
 }
Ejemplo n.º 12
0
 /// <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 InternalPropertyBaseBuilder(TPropertyBase metadata, InternalModelBuilder modelBuilder)
     : base(metadata, modelBuilder)
 {
 }
Ejemplo n.º 13
0
 /// <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 InternalServicePropertyBuilder(ServiceProperty property, InternalModelBuilder modelBuilder)
     : base(property, modelBuilder)
 {
 }
 public static AS400ModelBuilderAnnotations AS400([NotNull] this InternalModelBuilder builder, ConfigurationSource configurationSource)
 => new AS400ModelBuilderAnnotations(builder, configurationSource);
Ejemplo n.º 15
0
 /// <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>
 protected InternalMetadataItemBuilder([NotNull] TMetadata metadata, [NotNull] InternalModelBuilder modelBuilder)
     : base(metadata)
 {
     ModelBuilder = modelBuilder;
 }
Ejemplo n.º 16
0
 public static RelationalModelBuilderAnnotations Relational(
     [NotNull] this InternalModelBuilder builder,
     ConfigurationSource configurationSource)
 => new RelationalModelBuilderAnnotations(builder, configurationSource, null);
 private static void Cleanup(InternalModelBuilder modelBuilder)
 {
     new ModelCleanupConvention(new TestLogger <DbLoggerCategory.Model, TestLoggingDefinitions>())
     .ProcessModelFinalized(modelBuilder,
                            new ConventionContext <IConventionModelBuilder>(modelBuilder.Metadata.ConventionDispatcher));
 }
Ejemplo n.º 18
0
 private static void Cleanup(InternalModelBuilder modelBuilder)
 {
     new ModelCleanupConvention(CreateDependencies())
     .ProcessModelFinalized(modelBuilder,
                            new ConventionContext <IConventionModelBuilder>(modelBuilder.Metadata.ConventionDispatcher));
 }
Ejemplo n.º 19
0
 public SqlServerModelBuilderAnnotations(
     [NotNull] InternalModelBuilder internalBuilder,
     ConfigurationSource configurationSource)
     : base(new RelationalAnnotationsBuilder(internalBuilder, configurationSource, SqlServerAnnotationNames.Prefix))
 {
 }
 /// <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 InternalPropertyBuilder([NotNull] Property property, [NotNull] InternalModelBuilder modelBuilder)
     : base(property, modelBuilder)
 {
 }
Ejemplo n.º 21
0
 /// <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 InternalPropertyBaseBuilder([NotNull] TPropertyBase metadata, [NotNull] InternalModelBuilder modelBuilder)
     : base(metadata, modelBuilder)
 {
 }
Ejemplo n.º 22
0
 public InternalIndexBuilder([NotNull] Index index, [NotNull] InternalModelBuilder modelBuilder)
     : base(index, modelBuilder)
 {
 }
 /// <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 MySqlModelBuilderAnnotations MySql(
     [NotNull] this InternalModelBuilder builder,
     ConfigurationSource configurationSource)
 => new MySqlModelBuilderAnnotations(builder, configurationSource);