开发者

Can EntityFramework co-exist alongside legacy code

I have a legacy system with a very 'open' schema, where each table is a separate silo of information, no foreign keys are defined, and all table 'relationships' are actually managed via a separate set of开发者_JS百科 tables. I believe that I can use EF to look after the individual silo tables, and then use some of the legacy code/sql to handle the relationship records.

My question is this: can I combine EF and legacy processes together to update the database, and can I encompass all updates within a single transaction?

Thanks


As far as I know, EF will encapsulate all these for you. Just do EF operations. EF will convert your operations into valid SQL and, if you specify, wrap them in a transaction etc.

If you map your silo tables to EF correctly, EF will break the inserts/updates/deletes into those silo's for you. If you don't have relations, you can build some in EF as checks in your code -- EF won't mind that the actual database doesn't have integrity checks.

That's the whole point of using an ORM framework. It shields you from the actual database implementation.

0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜