How do I clear tracked entities in entity framework

后端 未结 6 1229
不知归路
不知归路 2020-12-04 20:50

I am running some correction code that runs over a big pile of entities, as it progress its speed decreases, that is because the number of tracked entities in the context in

6条回答
  •  眼角桃花
    2020-12-04 21:21

    Well my opinion is that, in my experience, EF, or being any orm, does not work well under too much pressure or complex model.

    If you don't want to track, really I would say why even do orm?

    If speed is the main force, nothing beats stored procedures and good indexing.

    And beyond, if your queries are always per id consider using a nosql or perhaps sql with just key and json. This would avoid the impedance problem between classes and tables.

    For your case scenario, loading things in objects that way seems very slow to me. Really in your case, stored procedures are better because you avoid the transport of data thru the network, and sql is way faster and optimized to manage aggregation and things like that.

提交回复
热议问题