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

数据库查询模块不主动释放DBContext #158

Open
YuanjianZhang opened this issue Aug 29, 2023 · 1 comment
Open

数据库查询模块不主动释放DBContext #158

YuanjianZhang opened this issue Aug 29, 2023 · 1 comment

Comments

@YuanjianZhang
Copy link

更新插入模块都有主动释放,查询没有,是有什么设计在里面吗?对于EF还在学习中,有点没能理解这块内容。

public async Task<T> FindEntity<T>(object keyValue) where T : class
{
return await dbContext.Set<T>().FindAsync(keyValue);
}
public async Task<T> FindEntity<T>(Expression<Func<T, bool>> condition) where T : class, new()
{
return await dbContext.Set<T>().Where(condition).FirstOrDefaultAsync();
}

@smartdust007
Copy link

smartdust007 commented Aug 29, 2023 via email

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