Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

需求对值对象的支持 #247

Open
RuiyanLiu opened this issue Jun 13, 2023 · 0 comments
Open

需求对值对象的支持 #247

RuiyanLiu opened this issue Jun 13, 2023 · 0 comments

Comments

@RuiyanLiu
Copy link

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);
}

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant