Click here to Skip to main content
15,897,518 members

Comments by fastal (Top 3 by date)

fastal 2-Jun-22 14:36pm View    
Ha this is like hit #3 on Google and all the wiseacres answering tell me to Google it - it's hilarious here that there's somebody smarter than those who bother to make that comment and that's the OP (also more polite than all of us)! If you're too lazy to post a link at minimum (lmgtfy links don't count), at least have the courtesy to keep your mouth shut.
fastal 4-Feb-18 22:29pm View    
I think you are on a track that would work.

I would think if you are still going to use repositories, do the mapping between the EF objects and YOUR objects INSIDE the repositories. Here is a great post that goes into more detail about doing it that way:
https://stackoverflow.com/questions/24588838/entities-vs-domain-models-vs-view-models

I refer to the same things when I say 'domain objects' and 'business objects' - but not all writers do that, I see. In that post, it appears as though they may mean the EF objects by 'domain' objects - although I'm not sure, that seems a non-standard way of doing it. Sorry for using both of the terms.

You will see most people don't talk about the 'DDD-Services' layer for composing and integrating your business objects. This example is no exception. Just make room for it in your project - it is not a layer that all properties need to be mapped to nor 'thru' - when you have some complicated inter-object logic, though, it may make more sense to make a new object in the services layer, inject the business objects that need the work done, and do the work there, to avoid mixing references to objects. Note - this is about 10% of the logic that really needs it, but, usually it's the more complicated logic ;-)

If your business objects don't hold references to repositories, it makes unit tests easier, there is less to mock... I would not recommend mocking nor abstracting your business objects either to test your domain layer objects - this will result in less granular units as they depend on the business objects, but if your business objects have good tests, that will mitigate this. This will give you most of the value of the tests without the technical debt of abstracting your business objects (which takes more than it gives). If this last paragraph doesn't make sense, ignore it ;-)
fastal 25-Jan-12 11:47am View    
Deleted
thanks, I have used that when I needed to mix. However this came in very handy when I wanted to have an app which was usually interactive, but, I wanted to access the console when run from a batch mode and not be interactive. This meant that I didn't want it to start a console in the background most of the time, only when there was a command line. Whereas a console app always displays one by default (not what I wanted) and you'd have to quick hide it. thanks.