- Joined
- Jul 6, 2005
- Messages
- 36,223
- Likes received
- 5,502
- Thanks received
- 1,182
- Location
- Covid City
That is the problem. Ba**ard self centered contractors adding in nonsense for the sake of it.
Oi!
I resemble that remark!

That is the problem. Ba**ard self centered contractors adding in nonsense for the sake of it.

I actually quite like DI frameworks - but buried down below the surface. Inject the factories, and have those factories build nice coarse grained objects with their dependencies hard-coded if you like.
I don't get the obsession with never being seen to be hard-coding any dependency, while hard-coding them in some uber DI config file somewhere.
I like DI because I've been in situations where I've found it useful for example I've moved a whole load of repositories from EF to Dapper. I could swap between classes in one place which is very convenient. It's also good for short release cycles, you can be working on a new replacement class but if it's not ready for the release just swap it back in the DI file. I also like to see less code in methods, i know it's only a few lines creating a new instance and passing the params but still it's not needed.
I find that it also encourages developers to use interfaces which often helps drum into them the importance of keeping your classes to a single responsibility. Also, makes developers think a little more about design before diving in.
I've gone off TDD/BDD. but yep it helps with mocking.
I will say one thing though, in the past I used Entity Framework alot but I really can't see that advantage of using it over a micro orm. I'm at the stage now where I would avoid a contract if it had EF in it - it just seems a mass of over complications for what is essentially getting data out of a db and mapping it to a class or collection.
They don't believe in the XML hell that is other DI frameworks.


So contractors, before you decide to use that new fangled technology so you can put it on your CV please remember it may be another contractor that has to inherit your crud.![]()
Did not think EF was new fangled tech, was using it years ago, sounds like your predecessor made a bad job of it. Most contractors being experienced and competent do a good job, you got unlucky.

Did not think EF was new fangled tech, was using it years ago, sounds like your predecessor made a bad job of it. Most contractors being experienced and competent do a good job, you got unlucky.

Does sound like one of DP's projects to be fair.![]()
I think we have spaghetti everythingYep I've seen the same with WCF and I've worked on projects where everything talked to each other via wcf and lots of different patterns- right pain. It was clear that know one understood how or why the project was put together that way and when I made a fix, I would look in the history see something similar and make the changes in the same files. It was clear other people did exactly the same.
I tend to keep it simple with a repository using dapper and a UI project. Do use service classes but only for things that don't necessarily fit into the repository or the controller. I was watching a video from a guy from Israel and basically he was saying don't use a repository do everything in the controller, so using linq accessing the db from the controller. His argument was that you rarely reuse repository methods and end up with a load of similar sounding and doing methods or lots of overloads. Don't quite agree with him on everything but was interesting. Oh I actually quite like dependency injection, sorry
I was hoping for more replies with other useful tools but there you go. Anyway good luck!