Breeze with a Unit Of Work/Repository pattern
Asked Answered
U

2

8

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?

Thanks

Underside answered 27/2, 2013 at 13:53 Comment(2)
Just looking into the guts of breeze and found the EF wrapper inside the Breeze.WebApi dll, I want those parts, in my class library, without any of the other jazz. Do these depend on anything that is MVC 4 specific? Maybe I could just put the dll in there and only use the EF parts of it?Underside
Ward has published out this link as guidance on the repo patter breezejs.com/spa-template#server Looking more into how to include breeze into my separate class libraries now.Underside
T
7

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

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.

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.

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.

Telic answered 20/3, 2013 at 4:45 Comment(4)
Thanks Ward, I'll look into that sample when it comes to see what you've done. As for now, I'm trying to build my own just so I can get a feel for everything (pretty new with the stuff and want to understand how it works)Underside
Just starting to learn about SPAs and Breeze. I'm using Angular and was curious if there is a TempHire sample project in the works using Angular?Hawsepipe
Not soon. But there is another sample coming (Zza) which uses Angular in a more sophisticated way than ToDo. It uses UoW for example.Telic
Is the new sample on GitHub or somewhere I can take a look now as it progresses? So far I've used the TempHire example for server side and ready to move into Angular / Breeze.Hawsepipe
W
1

Here is a post from the Breeze folks about how to use a UoW and Repo on the server with Breeze http://www.breezejs.com/spa-template#server

Widener answered 18/3, 2013 at 12:4 Comment(5)
Hey John, yea I've seen that. At this point, I'm more interested in how I can layer this out into a separate class library project (like you have done in your plural sight courses) without including all of the extra MVC stuff the Breeze dll includes. I only care because nuget tells me I need to be an MVC project to include this file, when I only want the data part.Underside
Install HotTowelette NuGet package. It has breeze, asp.net but no MVCWidener
Hi John... I see no mention of UoW in the link. Has it changed?Cramped
Ah, sorry. Its just Repo. I dont see a UoW example.Widener
Yea, no UoW.. But with Odata, you get custom queries, so that takes care of a lot of things that I needed the Repo and UoW for anyway. The UoW would be pretty nice to dish out different Bounded DbContexts though. I don't like the fact that you have to NuGet the whole BreezeWebApi dll in you class library just for the EFContextProvider though, but I'm just being picky I guess.Underside

© 2022 - 2024 — McMap. All rights reserved.