开发者

entity framework 4.1 faking dbcontext

开发者 https://www.devze.com 2023-04-10 07:14 出处:网络
Im using the entity framework 4.1 and have followed a tutorial to fake the dbcontext to mock and do unit tests.Everything works as expected with this.ive amended the original dbc开发者_Go百科ontext to

Im using the entity framework 4.1 and have followed a tutorial to fake the dbcontext to mock and do unit tests. Everything works as expected with this. ive amended the original dbc开发者_Go百科ontext to return idbset's however when i recreated my model it overwrote this. This is to be expected i suppose but wondered whether there is away i can stop this happening. Any ideas?


Probably the easiest approach is to replace the T4 templates that do the code generation with your own – copy the default templates into your project and adapt them to generate the code you want.

MSDN has an introduction: http://msdn.microsoft.com/en-us/data/gg558520


You can also use moles. But I like the t4 template better.

0

精彩评论

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