以工作单位/存储库模式进行微风 [英] Breeze with a Unit Of Work/Repository pattern

查看:52
本文介绍了以工作单位/存储库模式进行微风的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我只是想知道应该如何在单独的数据层项目中实施微风的 EFContextProvider 。另外,由于该项目是一个类库,而不是MVC 4应用程序,我应该如何将其包含到我的项目中?我真的不需要Breeze NuGet软件包中的所有技巧,只需 EFContextProvider 东西即可。我想使用 EFContextProvider DbContext包装器实现工作单元模式,就像John Papa在其精彩的复数课程中所做的那样。有人做过吗?有小费吗?

I was just wondering how I should go about implementing breeze's EFContextProvider in a separate data layer project. Also, since that project is a class library and not an MVC 4 application, how should I include this into my project? I don't really need the whole bag of tricks that is in the Breeze NuGet package, just EFContextProvider stuff. I want to implement a Unit of work pattern using the EFContextProvider DbContext wrapper, like John Papa has done in his wonderful pluralsight course. Has anyone done this yet? any tips?

谢谢

推荐答案

我们将提供更复杂的示例名为 TempHire,具有完整的UoW,Repos和单独的模型项目。

We've got a more sophisticated sample coming called "TempHire" that has a full blown UoW with Repos and separate model projects.

Breeze.NET组件(Breeze应用程序的.NET服务器端帮助程序.. .NET(如果您使用.NET)都放在一个.DLL中,它们完全不依赖MVC ... zip。那里有Web API的东西。也许这就是您所关心的。好吧……请记住,这是 GitHub上的开源。您不受限于Breeze .DLL。

Breeze.NET components (the .NET server-side helpers for a Breeze app ... if you're going with .NET) are all in a single .DLL They have no dependence on MVC at all ... zip. There is Web API stuff in there. Maybe that's what concerns you. Well ... remember that this is open source on GitHub. You are not constrained to the Breeze .DLL. Build your own out of the parts you want.

在我看来,UoW是距存储库的一小段路程。如果您了解什么是有界上下文,并且可以将其转换为DbContext实现,我想您自己不需要太多帮助。

In my view, the UoW is a short hop from Repository. If you understand what a bounded context is and can translate that to a DbContext implementation, I figure you shouldn't need much help making the transition yourself. There's no magic to it.

对于每个人,我都强烈建议在 Pluralsight设计模式课程 ...也许是我见过的最清晰,无术语的阐述。

For everyone I highly recommend Scott Allen's videos on Repository and UOW in the Pluralsight Design Patterns course ... perhaps the clearest, jargon-free exposition of these patterns I've ever seen.

这篇关于以工作单位/存储库模式进行微风的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆