Reputation
2,419
Top tag
Next privilege 2,500 Rep.
Create tag synonyms
Badges
2 5 10
Impact
~102k people reached

  • 0 posts edited
  • 0 helpful flags
  • 7 votes cast
Mar
14
comment Why shouldn't I use the repository pattern with Entity Framework?
There's no need for even that. EF6+ is 100% testable, and even prior versions implemented IDbSet for entity sets. You just couldn't mock the context, itself, but that hardly mattered. There's absolutely no reason to wrap anything around Entity Framework, except and unless, you're going to abstract away all the querying logic as well.
Jan
5
awarded  Popular Question
Dec
31
comment Exceptions - “what happened” vs “what to do”
Depends on whether there's actually a difference. Something like a web browser abstracts a lot of logic required to access web content, but typically when you're working with an API, you have a thin client. In that scenario, you need to know what status codes mean, how to respond to them, how to format a post body, how to set headers, etc. How it's done (the protocol) is totally intertwined with how it's used.
Dec
30
comment Implementing an interface when you don't need one of the properties
Absolutely. This is probably why it didn't feel right to me, in the first place. Sometimes you just need a gentle reminder that you're doing something stupid. Thanks.
Dec
30
accepted Implementing an interface when you don't need one of the properties
Dec
30
awarded  Nice Question
Dec
29
comment Implementing an interface when you don't need one of the properties
I'd definitely be interested to see that, if you can find it.
Dec
29
comment Implementing an interface when you don't need one of the properties
I think you're right. The interface is a contract after all, and even if I know this particular class won't be used in a way that it breaks anything that utilizes the interface if this property is disabled, that's not obvious.
Dec
29
asked Implementing an interface when you don't need one of the properties
Dec
28
comment Exceptions - “what happened” vs “what to do”
Again, I have to disagree. The protocol is very much a part of the API. It could be a REST API over HTTP or a SOAP API, the client needs to know which and needs to know how to communicate in that way. It's not an abstract implementation detail. It's a very real part of working with an API.
Dec
22
comment Exceptions - “what happened” vs “what to do”
@RomanBodnarchuk: I disagree. It's like saying a person shouldn't need to know Chinese in order to speak Chinese. HTTP is a protocol, and both the client and the server are expected to know it and follow it. That's how a protocol works. If only one side knows and abides by it, then you can't communicate.
Dec
18
awarded  Cleanup
Dec
18
revised Why shouldn't I use the repository pattern with Entity Framework?
rolled back to a previous revision
Oct
28
answered Entity Framework in n-tier application confusion
Sep
19
awarded  Yearling
Jul
13
awarded  Great Answer
Jul
13
comment Why shouldn't I use the repository pattern with Entity Framework?
Not really, because I'm also employing interfaces, so I can have a method like GetPublished<TEntity>() where TEntity : IPublishable. Sometimes I do tack on more specific methods via a partial class, though.
Jul
13
comment Why shouldn't I use the repository pattern with Entity Framework?
I usually have just one service per database or access method. I use generic methods to query multiple entity types from the same set of methods. I use Ninject to inject my context into my service and then my service into my controllers so everything is neat and tidy.
Jul
7
comment Why shouldn't I use the repository pattern with Entity Framework?
You of course have to change the service. But, what I'm talking about is having stuff like service.GetPublishedBlogPosts() in your controller actions. Then, if you want to switch to something like Web Api, you just have to alter that method, not every single call to it throughout your application. It's even easier if you use interfaces and dependency injection, as then you can just drop in a brand new service implementation and you're off to the races. You can't do this using repositories, since they don't return fully-baked data.
Apr
8
awarded  Populist