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

能否在ISelect插入执行前事件,可用于修改DbCommand内容 #229

Closed
tky753 opened this issue Mar 11, 2020 · 5 comments
Closed

Comments

@tky753
Copy link
Contributor

tky753 commented Mar 11, 2020

类似于UseMonitorCommand中的executing参数,
区别在于UseMonitorCommand对量产的所有ISelect起效,
现在需要的是只对单一的ISelect起效,如果可以实现的话,就可由用户自由修改生成的sql语句

@2881099
Copy link
Collaborator

2881099 commented Mar 11, 2020

换个解决办法,ISelect 有点重了

@2881099
Copy link
Collaborator

2881099 commented Mar 11, 2020

ISelect<T1>.IQueryable<T1> AsQueryable();

将 ISelect 转换为 IQueryable,此方法主要用于扩展,比如:abp IRepository GetAll() 接口方法需要返回 IQueryable 对象。注意:IQueryable 方法污染较为严重,请尽量避免此转换

今天加的这个方法

@tky753
Copy link
Contributor Author

tky753 commented Mar 11, 2020

AsQueryable()之后能否在 执行前修改DbCommand?
想要在执行前,把一段 join 语句替换成 outer apply,
虽然可以通过IAop.CommandBefore加事件,完事后再移除。
但如果IFreeSql多线程共用的话,还得加个判断避免其他线程也执行到了,稍微有些麻烦。

@2881099
Copy link
Collaborator

2881099 commented Mar 12, 2020

这个问题的初衷是不是这个:#200

@tky753
Copy link
Contributor Author

tky753 commented Mar 12, 2020

@tky753 tky753 closed this as completed Mar 12, 2020
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

2 participants