256 Comments

Unit Testing Rich Domain Model+1 Thanks for sharing something new I learned today. p.CallBase = true; works. But it's not a substitute for critical thinking, I should give more thoughts on what and what not to mock, and how to do effective unit testing

Jan1

comment

Unit Testing Rich Domain ModelOption 1 is good, but sadly it's incompatible with NHibernate, it will refuse to map a class with a non-virtual method in it. Guess a class can't serve two masters :D Or I can really try the third option, the p.CallBase = true;, but I concur with Sergey's answer; I should give more thoughts on behaviors, if it should be mocked or not

Dec31

comment

Unit Testing Rich Domain ModelLooks like a sound solution, I should rethink when to mock or not to mock. Perhaps I should lean more on testing the actual object, and use mocked object only in situations when it's foolish to test the actual object, e.g. component that downloads a file and waiting for it to finish

Is a Person an aggregate root?:-) I think I'm just wanting to have a confirmatory bias if it's ok to violate DDD (making OrderHeader a collection to Customer) just for the need of doing a LEFT JOIN mechanism conveniently on NHibernate's Linq. QueryOver's LEFT JOIN mechanism is too convoluted and needlessly complicated compared to Linq. NHibernate's QueryOver can make a LEFT JOIN manually, i.e., even without mapping a collection, but its approach is too horrible and too tedious, I'm not ready to embrace NHibernate's QueryOver yet just for adhering to DDD properly :-)

Sep14

comment

Is a Person an aggregate root?@DanielSchilling The example I gave on my question is already an specific use case. Cannot flip around the LEFT JOIN construct with the use case above, must start from CustomerID then down to their OrderHeaders. The only way I can do pure DDD on the Customer, i.e., not making Customer the aggregate's root while being able to produce reports like my edit above is to use NHibernate's QueryOver

Sep13

comment

Is a Person an aggregate root?@DanielSchilling That's the only example I cited for the rationale on flattening the result, by doing a LEFT JOIN manually, i.e., via Linq's join and .DefaultIfEmpty :-) Exporting to spreadsheet or CSV is not the only use case for doing manual join and .DefaultIfEmpty()

NHibernate mapping, when is the model mapping bloated?It will look like I have a confirmatory bias if I quickly accept this. I'll just upvote this first and wait for others to chime in and get their perspective, and see if they are against overly mapped models / bloated models. But yeah, I also believe there's no such thing as bloated model as long they are confined to primarykey-foreignkey / foreignkey-primarykey relationships

May23

comment

NHibernate mapping, when is the model mapping bloated?@DiegoMijelshon The Y of the X: We are using QueryOver's left join to work-around for the fact that we don't map some models as a collection to another model(s), another Y is we are using QueryOver as .DefaultIfEmpty(Linq's LEFT JOIN) is still not available on NHibernate's Linq. The X of the Y, a.k.a. the actual problem: To map or not to map some models as a collection to another model(s), we tend not to map collections as we feel it will overly bloat the owning model(an example, think of master table here, especially Person, StoreBranch, etc)

Routing path with ServiceStackYep, I know it's node.js. Just wanted to know if routing is possible with ServiceStack(serving html). I'm using ServiceStack using stand-alone self-hosting. Aside from routing on client-side with AngularJS, the routing should be supported by server-side too, I'm thinking if routing is possible on ServiceStack serving the html. Here's where I get the screenshot: youtube.com/watch?v=5uhZCc0j9RY

How to make a percent formatted input work on latest AngularJS?Thanks! Regarding second inquiry, I'm looking for an input for currency instead, i.e. when keying-in input, the control automatically put comma(s). Perhaps I'll just start from your fiddle on percent for accomplishing the currency input. Thanks very much!