Open RuiyanLiu opened 1 year ago
public class Category { public Category() { }
public Guid Id { get; set; } [ValueObj] public virtual Handler Create { get; set; }
}
public class Handler { public DateTime Time { get; set; }
public string UserId { get; set; }
public void Configure(EntityTypeBuilder builder) { builder.Property(c => c.Id); builder.OwnsOne(p => p.Create,p =>{ p.Property(e => e.UserId).HasComment("创建人");p.Property(e => e.Time).HasComment("创建时间");}); builder.ToTable("Categories"); }
// 需求支持以下这种方式分片 public override void Configure(EntityMetadataTableBuilder builder) { builder.ShardingProperty(o => o.Create.Time); }
public class Category { public Category() { }
}
public class Handler { public DateTime Time { get; set; }
}
public void Configure(EntityTypeBuilder builder)
{
builder.Property(c => c.Id);
builder.OwnsOne(p => p.Create,p =>{ p.Property(e => e.UserId).HasComment("创建人");p.Property(e => e.Time).HasComment("创建时间");});
builder.ToTable("Categories");
}
// 需求支持以下这种方式分片 public override void Configure(EntityMetadataTableBuilder builder)
{
builder.ShardingProperty(o => o.Create.Time);
}