linq写法对于过滤器无效 返回

SqlSugar 沟通中
11 365

Db.Queryable<SysUser, SysUserRole, SysRole, SysOrganization>(

                    (u, ur, r, o) => new object[]

                    {

                    JoinType.Inner, u.id==ur.userId,

                    JoinType.Inner, ur.roleId == r.id,

                    JoinType.Left,u.organizationId==o.id

                    }

                )

image.png增加的全局过滤器都没有生效

热忱回答11

  • smallxin smallxin VIP0
    2024/7/23

    为啥实体指定了租户id后,过滤器都不再生效了?sql追踪后面都没有自动添加表过滤器

    0 回复
  • fate sta fate sta VIP0
    2024/7/23

    db.GetConnection("1").QueryableFilter.AddTableFilter

    0 回复
  • fate sta fate sta VIP0
    2024/7/23

    多租户是这样用的

    0 回复
  • smallxin smallxin VIP0
    2024/7/23

    问题:注入服务后在构造函数中可以看到有过滤器,离开构造函数后过滤器被清空了

    image.png

    image.png

    image.png

    image.png

    0 回复
  • fate sta fate sta VIP0
    2024/7/23

    用getconnection不要用getconnectionScope

    0 回复
  • fate sta fate sta VIP0
    2024/7/23

    还有疑问提供完整的测试用例。这个讲不清楚

    0 回复
  • smallxin smallxin VIP0
    2024/7/23

    可以了

    0 回复
  • smallxin smallxin VIP0
    2024/7/23

    image.png

    异步方法报错

    image.png


    0 回复
  • smallxin smallxin VIP0
    2024/7/23

    image.png

    0 回复
  • smallxin smallxin VIP0
    2024/7/23

    使用GetConnection在使用异步多线程时连接关闭问题频发,如何使用GetConnectionScope线程安全的情况下,保证服务对象的过滤器不被清除呢?


    0 回复
  • fate sta fate sta VIP0
    2024/7/23

    var newDb=db.CopyNew();

    下面用newDb保证线程安全

    0 回复