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 November 26th, 2010, 04:06 AM
Authorized User
 
Join Date: Jan 2006
Posts: 13
Thanks: 6
Thanked 1 Time in 1 Post
Default Where to define all the Interfaces?

Hi Scott,

I have studied your code for a while and I am used to see you define all the IxxxRepository inside the Model.

However, when it comes to IxxxService as in Chapter 6, you put the interfaces under a special Contract name space.

Is it because you use WCF in chapter 6? Or is it generally a good idea to have a special Contract and DataContract for the Interfaces for the Service layer?

What about IxxxRepositories? Should we define them and the DTO's outside of Model, and let both the Service and Repository reference them?
 
Old November 26th, 2010, 05:07 AM
elbandit's Avatar
Wrox Author
 
Join Date: May 2007
Posts: 107
Thanks: 10
Thanked 17 Times in 15 Posts
Default

Hi SamVan,

I define the repository interfaces within the model because domain services may need to use them at some point. I use projects to help define responsibility boundaries but you could do just the same with namespaces and folders all within one class project.

Quote:
Is it because you use WCF in chapter 6? Or is it generally a good idea to have a special Contract and DataContract for the Interfaces for the Service layer?
I did this to emphasis the responsibilities of each part of the WCF implementation also the client code will use the Contract and DataContract but I didn't want the client having a reference to the actual service implementation, this is why I split them up.

Quote:
What about IxxxRepositories? Should we define them and the DTO's outside of Model, and let both the Service and Repository reference them?
Not sure what you mean with this question. What are the IxxxRepositories?

Cheers
Scott
 
Old November 29th, 2010, 03:28 AM
Authorized User
 
Join Date: Jan 2006
Posts: 13
Thanks: 6
Thanked 1 Time in 1 Post
Default

"IxxxRepository" sorry, my typo.

Ok, I guess I know what you are saying: If I am not distributing the objects, I can define everything in a single project -> just put different layers separately into folders and use different namespaces. And if I somehow need to use WCF, I will have to put the interface and DTO into a dll of their own so that the client and the server at different locations can reference them separately.

The location of the Interface definition depends on the context and the software architecture, and there is not an answer that is correct in all situations.

Am I right?

Thanks Scott
 
Old November 30th, 2010, 06:34 AM
elbandit's Avatar
Wrox Author
 
Join Date: May 2007
Posts: 107
Thanks: 10
Thanked 17 Times in 15 Posts
Default

Quote:
The location of the Interface definition depends on the context and the software architecture, and there is not an answer that is correct in all situations.

Am I right?
Yep you've got the idea. Remember context is king.

Cheers
Scott
The Following User Says Thank You to elbandit For This Useful Post:
samvan (November 30th, 2010)





Similar Threads
Thread Thread Starter Forum Replies Last Post
Understanding Interfaces PolishPaul BOOK: Beginning Microsoft Visual C# 2008 ISBN: 978-0-470-19135-4 0 October 18th, 2009 07:14 AM
interfaces malli_kv2 Java Basics 1 April 23rd, 2007 05:21 AM
Instantiating Interfaces simsdagr8 C# 2005 4 November 30th, 2006 07:37 AM
[CH04] Interfaces Norm 2782 BOOK: Professional PHP 5 ISBN: 978-0-7645-7282-1 3 June 16th, 2005 04:56 AM
Polymorphism with Interfaces digby_dog VB.NET 2002/2003 Basics 2 May 11th, 2005 12:50 PM





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