Wrox Programmer Forums
|
BOOK: Professional ASP.NET Design Patterns
This is the forum to discuss the Wrox book Professional ASP.NET Design Patterns by Scott Millett; ISBN: 978-0-470-29278-5
Welcome to the p2p.wrox.com Forums.

You are currently viewing the BOOK: Professional ASP.NET Design Patterns section of the Wrox Programmer to Programmer discussions. This is a community of software programmers and website developers including Wrox book authors and readers. New member registration was closed in 2019. New posts were shut off and the site was archived into this static format as of October 1, 2020. If you require technical support for a Wrox book please contact http://hub.wiley.com
 
Old December 6th, 2011, 10:12 AM
elbandit's Avatar
Wrox Author
 
Join Date: May 2007
Posts: 107
Thanks: 10
Thanked 17 Times in 15 Posts
Default

Hi Mike,

In the context of your admin system it sounds like CustomerStatus could be its own aggregate but as it seems to be just a look up object without any behaviour you might not need to worry about aggregate roots and DDD. For your system which contains a customer you might have some complex logic and in this context customer status is a value object that is associated with a customer.

Cheers
Scott
 
Old December 19th, 2011, 10:25 AM
Registered User
 
Join Date: Dec 2011
Posts: 7
Thanks: 0
Thanked 0 Times in 0 Posts
Default

Hi Scott,

Thank you for your input and I have managed to solve my issue.

As a result of this I have another issue with aggregate roots and its own repository.

I have a customer aggregate root and it has its own repository but I need to query the contact table which does not have its own repository as it is an aggregate of the customer.

My table structure is below.

Customer -----> Address -----> Contact.

Is it correct to query the customer repository with an ID and then from the service layer to use a lambda expression to query the address table and then the contact table?

My issue is I do not know the lambda expression to query the contact table because I don't know the address ID.
My latest attempt is below.

Quote:
Dim cust As New Customer
cust = _customerRepository.FindBy(addRequest.ID)
cust.CustomerAddresses.Any(Function(x) x.Contacts.Where(Function(co) co.Id = 12))
The lambda expression is clearly wrong but I need to query the contact table.

Any suggestions would be great.

Thank you.









Powered by vBulletin®
Copyright ©2000 - 2020, Jelsoft Enterprises Ltd.
Copyright (c) 2020 John Wiley & Sons, Inc.