LINQ-To-SQL - 是否可以缓存 GetTable 或从存储库提供它?
我在 LINQ-to-SQL 数据访问层上运行探查器工具。
大量时间花费在 GetTable
上,因为每次 CRUD 数据时都会调用它。
当应用程序启动时,是否可以缓存所有表的 GetTable
,或者通过某种存储在内存中的存储库来提供它?
谢谢
编辑:或者,有没有办法避免使用 GetTable<> ?
I'm running profiler tools on the LINQ-to-SQL data access layer.
A lot of the time is spent on GetTable<clsName>()
because it's being called each time i CRUD data.
Is it possible to cache GetTable<clsName>()
for all the tables when the application starts or serve it through some sort of repository where it will be in memory?
Thank you
Edit: Alternatively, is there a way to avoid using GetTable<> ?
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(1)
我认为不可能避免得到它,但缓存它似乎应该是合理的。
这似乎应该接受“工程师测试”(“确保它不在你和门之间,然后将其插上!”)
I don't think it's possible to avoid getting it, but caching it seems like to should be reasonable.
This seems like something that should be put to the "Engineer's Test" ("Make sure it's not between you & the door, and plug it it!")