Timeline for Repository Pattern with Services Layer - Good Practice?
Current License: CC BY-SA 4.0
11 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
May 2, 2023 at 17:09 | comment | added | Jeremy Belolo | What an incredible answer! You, sir, deserve a medal for educating the world. | |
Aug 11, 2021 at 8:50 | comment | added | Subliminal Hash | Nearly a year later, I must say I have to accept this not as an answer but as a lecture as if I took it in a class. Did a lot of research, made a lot of sample projects, watched a lot of videos and read quite a lot of articles. It all now makes sense and I can't believe how my mindset was before. Thank you very much for what you have tought me! | |
Aug 11, 2021 at 8:48 | vote | accept | Subliminal Hash | ||
Oct 30, 2020 at 17:09 | comment | added | Flater | @SubliminalHash: (1) Skipping the DAL in favor of EF is a contentious issue. By that I mean that many people oppose it... but I don't. In the video I linked, Jason Taylor explains the reasoning why a repository layer can be skipped when using EF in certain cases, and I agree with him. But very much mind the bolded part! (2) To solve the Foo trap, read up on DDD (domain driven design), specifically aggregates and aggregate roots. Plenty to find online (3) About your last comment, there's more to it than that, but the DDD guide you find online will already address that. | |
Oct 30, 2020 at 13:32 | comment | added | Subliminal Hash |
** Comment 4/4 - **I am not an experienced developer. The unknowns to approaching the problem - let alone identifying it - is a very steep journey for me. Guidance in starting at the right point is all I want. So, I'll now try to eliminate all the relational entities as repositories and seek ways of manipulating them through the main object they belong to.. E.g. Instead of having a repository for the ProductPackaging separately, I will do the basic CRUD through the main Product by doing Product.ProductPackaging = new ProductPackaging {...} within the ProductRepository am I right?
|
|
Oct 30, 2020 at 13:31 | comment | added | Subliminal Hash |
** Comment 3/4 - ** Until.... You identified my problem - The Foo Trap.. I am definitely in it. In my project, my "subdomains" are Store, Product and Customer. Remaining are sub classes such as StoreOpeningHour.cs , ProductPackagingOption.cs which 99% of the time can be etc... I ended up just like you described above. 99% of the time all the I am not moaning about spending time. I am trying to learn here but I also believe in spending time efficiently.
|
|
Oct 30, 2020 at 13:31 | comment | added | Subliminal Hash | ** Comment 2/4 - **The issue is whether implementing this sort of architecture (fully/partially) has a "VALUE" or not for a particular case/project. In my case, given the facts above, introducing a repository pattern is a burdon on me causing a lot of time consuming work and I was thinking to get my services layer couple with EF directly would be a better choice.. | |
Oct 30, 2020 at 13:31 | comment | added | Subliminal Hash | ** Comment 1/4 - **As I read and watch more about the subject, I am quite close to coming to a conclusion that the matter is not the answer to the question but rather whether it is the right question to ask or not. I am a single dev working on simple to mid sized projects that are not for any customers but for my own use within my own businesses. I have and will always (until they are replaced by their own predecessors) use SQL server, EF | |
Oct 30, 2020 at 12:12 | history | edited | Flater | CC BY-SA 4.0 |
added 149 characters in body
|
Oct 30, 2020 at 12:06 | history | edited | Flater | CC BY-SA 4.0 |
added 357 characters in body
|
Oct 30, 2020 at 11:56 | history | answered | Flater | CC BY-SA 4.0 |