Wrox Programmer Forums

Need to download code?

View our list of code downloads.

Go Back   Wrox Programmer Forums > ASP.NET and ASP > Other ASP.NET > BOOK: Professional ASP.NET Design Patterns
Password Reminder
Register
| FAQ | Members List | Search | Today's Posts | Mark Forums Read
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 tens of thousands of software programmers and website developers including Wrox book authors and readers. As a guest, you can read any forum posting. By joining today you can post your own programming questions, respond to other developers’ questions, and eliminate the ads that are displayed to guests. Registration is fast, simple and absolutely free .
DRM-free e-books 300x50
Reply
 
Thread Tools Search this Thread Display Modes
  #1 (permalink)  
Old November 26th, 2010, 04:06 AM
Authorized User
 
Join Date: Jan 2006
Location: , , Canada.
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?
Reply With Quote
  #2 (permalink)  
Old November 26th, 2010, 05:07 AM
elbandit's Avatar
Wrox Author
Points: 599, Level: 8
Points: 599, Level: 8 Points: 599, Level: 8 Points: 599, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2007
Location: Southsea, Portsmouth, Hampshire, United Kingdom.
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
Reply With Quote
  #3 (permalink)  
Old November 29th, 2010, 03:28 AM
Authorized User
 
Join Date: Jan 2006
Location: , , Canada.
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
Reply With Quote
  #4 (permalink)  
Old November 30th, 2010, 06:34 AM
elbandit's Avatar
Wrox Author
Points: 599, Level: 8
Points: 599, Level: 8 Points: 599, Level: 8 Points: 599, Level: 8
Activity: 0%
Activity: 0% Activity: 0% Activity: 0%
 
Join Date: May 2007
Location: Southsea, Portsmouth, Hampshire, United Kingdom.
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
Reply With Quote
The Following User Says Thank You to elbandit For This Useful Post:
samvan (November 30th, 2010)
Reply


Thread Tools Search this Thread
Search this Thread:

Advanced Search
Display Modes

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Trackbacks are Off
Pingbacks are On
Refbacks are Off


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



All times are GMT -4. The time now is 08:21 PM.


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