1

We have a system built using Entity Framework 5 for creating, editing and deleting data but the problem we have is that sometimes EF is too slow or it simply isn't possible to use entity framework (Views which build data for tables based on users participating in certain groups in database, etc) and we are having to use a stored procedure to update the data.

However we have gotten ourselves into a problem where we are having to save the changes to EF in order to have the data in the database and then call the stored procedures, we can't use ITransactionScope as it always elevates to a distributed transaction and/or locks the table(s) for selects during the transaction.

We are also trying to introduce a DomainEvents pattern which will queue events and raise them after the save changes so we have the data we need in the DB but then we may end up with the first part succeeding and the second part failing.

Are there any good ways to handle this or do we need to move away from EF entirely for this scenario?

4

1 に答える 1

1

同様のシナリオがありました。後で、プロセスを小さなプロセスに分割し、EF のみを使用して、それぞれの小さなプロセスを短くします。全体的な時間はさらに長くなりますが、システムの保守と拡張が容易になります。また、結合を最小限に抑え、エンティティ自体のみを更新し、EF の AutoDetectChangesEnabled と ValidateOnSaveEnabled を無効にしました。
問題をさまざまな方法で見ると、より良い解決策が見つかる場合があります。幸運を!

于 2013-03-28T17:18:09.093 に答える