FreeSql icon indicating copy to clipboard operation
FreeSql copied to clipboard

【建议】导航属性增加自定义过滤条件

Open cps8 opened this issue 7 months ago • 2 comments

建议:

  1. ManyToOne和OneToMany导航增加自定义过滤条件,
  2. 同步更新[https://freesql.net/guide/]的文档至当前版本且备注不同版本差异,因为文档中很多细节都介绍不完整,对于新手学习曲线比较陡峭

cps8 avatar May 07 '25 03:05 cps8

ManyToOne:

.LeftJoin(a => a.Parent.Id == a.ParentId && a.Parent.xxx > 0)

OneToMany:

.IncludeMany(a => a.Children, then => then.Where(child => child.xxx > 0))

2881099 avatar May 07 '25 04:05 2881099

在仓储模式中 使用导航属性在curd时可以自动完成关联对象的相同操作,使用LeftJoin或者IncludeMany还需要手动操作关联对象

cps8 avatar May 09 '25 03:05 cps8

ManyToOne:

.LeftJoin(a => a.Parent.Id == a.ParentId && a.Parent.xxx > 0)

OneToMany:

.IncludeMany(a => a.Children, then => then.Where(child => child.xxx > 0))

可以在Navigate里设置多个列的导航条件吗

Gn3po4g avatar Dec 11 '25 05:12 Gn3po4g

@Gn3po4g 可以,用逗号分割,和对方的主键对应

2881099 avatar Dec 11 '25 08:12 2881099