protected override void Configure(OwnedNavigationBuilder <Level3, Level4> l4) { base.Configure(l4); l4.ToTable(nameof(Level1)); }
public NonGenericTestOwnedNavigationBuilder(OwnedNavigationBuilder ownedNavigationBuilder) { OwnedNavigationBuilder = ownedNavigationBuilder; }
public GenericTypeTestOwnedNavigationBuilder(OwnedNavigationBuilder <TEntity, TRelatedEntity> ownedNavigationBuilder) : base(ownedNavigationBuilder) { }
protected override GenericTestOwnedNavigationBuilder <TNewEntity, TNewRelatedEntity> Wrap <TNewEntity, TNewRelatedEntity>( OwnedNavigationBuilder <TNewEntity, TNewRelatedEntity> referenceOwnershipBuilder) => new GenericStringTestOwnedNavigationBuilder <TNewEntity, TNewRelatedEntity>(referenceOwnershipBuilder);
public override TestOwnedNavigationBuilder <TDependentEntity, TNewDependentEntity> OwnsMany <TNewDependentEntity>( Expression <Func <TDependentEntity, IEnumerable <TNewDependentEntity> > > navigationExpression) => Wrap( OwnedNavigationBuilder.OwnsMany <TNewDependentEntity>(navigationExpression?.GetMemberAccess().GetSimpleMemberName()));
public OwnedNavigationTableBuilder(string?name, string?schema, OwnedNavigationBuilder referenceOwnershipBuilder) : base(name, schema, referenceOwnershipBuilder) { }
protected override NonGenericTestOwnedNavigationBuilder <TNewEntity, TNewDependentEntity> Wrap <TNewEntity, TNewDependentEntity>( OwnedNavigationBuilder ownedNavigationBuilder) => new NonGenericStringTestOwnedNavigationBuilder <TNewEntity, TNewDependentEntity>(ownedNavigationBuilder);
public override TestOwnedNavigationBuilder <TEntity, TDependentEntity> OwnsMany <TNewDependentEntity>( Expression <Func <TDependentEntity, IEnumerable <TNewDependentEntity> > > navigationExpression, Action <TestOwnedNavigationBuilder <TDependentEntity, TNewDependentEntity> > buildAction) => Wrap(OwnedNavigationBuilder.OwnsMany <TNewDependentEntity>(navigationExpression?.GetPropertyAccess().GetSimpleMemberName(), r => buildAction(Wrap(r))));
public static OwnedNavigationBuilder <TOwner, GeoPosition> BuildGeoPosition <TOwner>(this OwnedNavigationBuilder <TOwner, GeoPosition> builder, string prefix = null) where TOwner : class { builder.Property(p => p.Latitude).HasColumnName($"{prefix}latitude").HasColumnType("decimal(11,8)"); builder.Property(p => p.Longitude).HasColumnName($"{prefix}longitude").HasColumnType("decimal(11,8)"); return(builder); }
public override TestReferenceNavigationBuilder <TRelatedEntity, TNewRelatedEntity> HasOne <TNewRelatedEntity>( Expression <Func <TRelatedEntity, TNewRelatedEntity> > navigationExpression = null) => new GenericTypeTestReferenceNavigationBuilder <TRelatedEntity, TNewRelatedEntity>( OwnedNavigationBuilder.HasOne(navigationExpression));
public override TestOwnedNavigationBuilder <TDependentEntity, TNewDependentEntity> OwnsOne <TNewDependentEntity>( Expression <Func <TDependentEntity, TNewDependentEntity> > navigationExpression) => Wrap(OwnedNavigationBuilder.OwnsOne <TNewDependentEntity>(navigationExpression?.GetPropertyAccess().GetSimpleMemberName()));
static void StoreMassUnitAsSymbol <T>(OwnedNavigationBuilder <T, Mass> onb) where T : class => onb.Property(m => m.Unit) .HasConversion( u => u.Symbol, s => MassUnit.FromSymbol(s)) .HasMaxLength(3);
static void StoreCurrencyAsCode <T>(OwnedNavigationBuilder <T, Money> onb) where T : class => onb.Property(m => m.Currency) .HasConversion( c => c.Code, c => Currency.FromCode(c)) .HasMaxLength(3);
/// <summary> /// Configures the table that the entity type maps to when targeting a relational database. /// </summary> /// <param name="referenceOwnershipBuilder"> The builder for the entity type being configured. </param> /// <param name="name"> The name of the table. </param> /// <param name="schema"> The schema of the table. </param> /// <returns> The same builder instance so that multiple calls can be chained. </returns> public static OwnedNavigationBuilder ToTable( [NotNull] this OwnedNavigationBuilder referenceOwnershipBuilder, [CanBeNull] string name, [CanBeNull] string schema) => referenceOwnershipBuilder.ToTable(name, schema, excludedFromMigrations: false);
/// <summary> /// 表说明 /// </summary> /// <typeparam name="TEntity"></typeparam> /// <typeparam name="TDependentEntity"></typeparam> /// <param name="ownedNavigationBuilder"></param> /// <param name="description"></param> /// <returns></returns> public static OwnedNavigationBuilder <TEntity, TDependentEntity> HasDescription <TEntity, TDependentEntity>([NotNull] this OwnedNavigationBuilder <TEntity, TDependentEntity> ownedNavigationBuilder, [NotNull] string description) where TEntity : class where TDependentEntity : class { return(ownedNavigationBuilder.HasAnnotation(ModelBuilderExtension.DbDescriptionAnnotationName, description)); }
public static OwnedNavigationBuilder <TOwner, Dimensions> BuildDimensions <TOwner>(this OwnedNavigationBuilder <TOwner, Dimensions> builder, string prefix = null, bool required = false) where TOwner : class { builder.Property(d => d.Height).HasColumnType("decimal(16,6)").HasColumnName($"{prefix}height"); builder.Property(d => d.Length).HasColumnType("decimal(16,6)").HasColumnName($"{prefix}length"); builder.Property(d => d.Width).HasColumnType("decimal(16,6)").HasColumnName($"{prefix}width"); builder.Property(d => d.Unit).IsUnicode(false).HasMaxLength(2).HasColumnName($"{prefix}dimension_unit"); builder.Property(d => d.Unit).HasConversion <string>(); return(builder); }
public static void Setup <T>(OwnedNavigationBuilder <T, Test> entity) where T : class { entity.Property(e => e.Ordinal).IsRequired(); entity.Property(e => e.MapLocation).IsRequired(); }
public static OwnedNavigationBuilder <TOwner, StreetAddress> BuildStreetAddress <TOwner>(this OwnedNavigationBuilder <TOwner, StreetAddress> builder, string prefix = null, bool required = false) where TOwner : class { //builder.Property(p => p.Street).IsSeparatorDelimited(); builder.Property(p => p.Country).HasColumnName($"{prefix}country").IsCode(2, required: required); builder.Property(p => p.City).HasColumnName($"{prefix}city").HasMaxLength(100).IsRequired(required); builder.Property(p => p.State).HasColumnName($"{prefix}state").HasMaxLength(100); builder.Property(p => p.PostCode).HasColumnName($"{prefix}post_code").HasMaxLength(20).IsUnicode(false); builder.Property(p => p.Street).HasColumnName($"{prefix}street").HasMaxLength(1024); return(builder); }
public NonGenericStringTestOwnedNavigationBuilder(OwnedNavigationBuilder ownedNavigationBuilder) : base(ownedNavigationBuilder) { }
public override TestOwnedNavigationBuilder <TDependentEntity, TNewDependentEntity> OwnsMany <TNewDependentEntity>( Expression <Func <TDependentEntity, IEnumerable <TNewDependentEntity> > > navigationExpression) => Wrap <TDependentEntity, TNewDependentEntity>( OwnedNavigationBuilder.OwnsMany( typeof(TNewDependentEntity).FullName, navigationExpression.GetPropertyAccess().GetSimpleMemberName()));
public GenericStringTestOwnedNavigationBuilder(OwnedNavigationBuilder <TEntity, TDependentEntity> ownedNavigationBuilder) : base(ownedNavigationBuilder) { }
public override TestReferenceNavigationBuilder <TDependentEntity, TNewDependentEntity> HasOne <TNewDependentEntity>( Expression <Func <TDependentEntity, TNewDependentEntity> > navigationExpression = null) => new NonGenericStringTestReferenceNavigationBuilder <TDependentEntity, TNewDependentEntity>( OwnedNavigationBuilder.HasOne( typeof(TNewDependentEntity).FullName, navigationExpression?.GetPropertyAccess().GetSimpleMemberName()));
public override TestOwnershipBuilder <TEntity, TDependentEntity> WithOwner( Expression <Func <TDependentEntity, TEntity> > referenceExpression) => new GenericTestOwnershipBuilder <TEntity, TDependentEntity>( OwnedNavigationBuilder.WithOwner(referenceExpression?.GetMemberAccess().GetSimpleMemberName()));
public GenericTestOwnedNavigationBuilder(OwnedNavigationBuilder <TEntity, TDependentEntity> ownedNavigationBuilder) { OwnedNavigationBuilder = ownedNavigationBuilder; }
public override TestReferenceNavigationBuilder <TDependentEntity, TNewRelatedEntity> HasOne <TNewRelatedEntity>( Expression <Func <TDependentEntity, TNewRelatedEntity> > navigationExpression = null) => new GenericStringTestReferenceNavigationBuilder <TDependentEntity, TNewRelatedEntity>( OwnedNavigationBuilder.HasOne <TNewRelatedEntity>(navigationExpression?.GetMemberAccess().GetSimpleMemberName()));
public override TestOwnedNavigationBuilder <TDependentEntity, TNewDependentEntity> OwnsOne <TNewDependentEntity>( Expression <Func <TDependentEntity, TNewDependentEntity?> > navigationExpression) where TNewDependentEntity : class => Wrap( OwnedNavigationBuilder.OwnsOne <TNewDependentEntity>(navigationExpression.GetMemberAccess().GetSimpleMemberName()));
protected virtual NonGenericTestOwnedNavigationBuilder <TNewEntity, TNewDependentEntity> Wrap <TNewEntity, TNewDependentEntity>( OwnedNavigationBuilder ownedNavigationBuilder) where TNewEntity : class where TNewDependentEntity : class => new NonGenericTestOwnedNavigationBuilder <TNewEntity, TNewDependentEntity>(ownedNavigationBuilder);
/// <summary> /// Configures the table that the entity type maps to when targeting a relational database. /// </summary> /// <typeparam name="TEntity"> The entity type being configured. </typeparam> /// <typeparam name="TRelatedEntity"> The entity type that this relationship targets. </typeparam> /// <param name="referenceOwnershipBuilder"> The builder for the entity type being configured. </param> /// <param name="name"> The name of the table. </param> /// <returns> The same builder instance so that multiple calls can be chained. </returns> public static OwnedNavigationBuilder <TEntity, TRelatedEntity> ToTable <TEntity, TRelatedEntity>( [NotNull] this OwnedNavigationBuilder <TEntity, TRelatedEntity> referenceOwnershipBuilder, [CanBeNull] string name) where TEntity : class where TRelatedEntity : class => (OwnedNavigationBuilder <TEntity, TRelatedEntity>)ToTable((OwnedNavigationBuilder)referenceOwnershipBuilder, name);
protected override GenericTestOwnedNavigationBuilder <TNewEntity, TNewRelatedEntity> Wrap <TNewEntity, TNewRelatedEntity>( OwnedNavigationBuilder <TNewEntity, TNewRelatedEntity> ownedNavigationBuilder) => new GenericTypeTestOwnedNavigationBuilder <TNewEntity, TNewRelatedEntity>(ownedNavigationBuilder);
protected override void Configure(OwnedNavigationBuilder <Level2, Level3> l3) { base.Configure(l3); l3.ToTable(nameof(Level1)); }