Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 386723
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T15:36:14+00:00 2026-05-12T15:36:14+00:00

Is it good practice to reference my web applications domain layer class library to

  • 0

Is it good practice to reference my web applications domain layer class library to WCF service application.

Doing that gives me easy access to the already existing classes on my domain model so that I will not need to re-define similar classes to be used by the WCF service

On the other hand, I don’t like the coupling that it creates between the application and service and i am curious if it could create difficulties for me on the long run.

I also think having dedicated classes for my WCF app would be more efficient since those classes will only contain the members that will be used by the service and nothing else. If I use the classes from my domain layer there will be many fields in the classes that will not be used by the service and it will cause unnecessary data transfer.

I will appreciate if you can give me your thoughts from your experience

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-12T15:36:14+00:00Added an answer on May 12, 2026 at 3:36 pm

    I personally frown on directly passing domain objects directly through WCF. As Krzysztof said, it’s about a data contract not a contract about the behavior of the the thing you are passing over the wire.

    I typically do this:

    • Define the data contracts in their own assembly
    • The service has a reference to both the data contracts assembly and the business entity assemblies.
    • Create extension methods in the service namespace that map the entities to their corresponding data contracts and vice versa.

    Putting the conceptual purity of what a “Data Contract” is aside, If you begin to pass entities around you are setting up your shared entity to pulled in different design directions by each side of the WCF boundary. Inevitably you’ll end up with behaviors that only belong to one side, or even worse – have to expose methods that conceptually do the same thing but in a different way for each side of the WCF boundary. It can potentially get very messy over the long term.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

Is it good practice to have a class constructor that uses default parameters, or
Is it good practice to let abstract classes define instance variables? public abstract class
It is good practice to use the main method to test a java/.net class?
Is it good practice to have a unit test that specifies how long a
Is it a good practice to comment code that is removed? For example: //
What good-practice-indicating idioms do you look for in a sequence of method invocations, as
Is it good practice to delegate data validation entirely to the database engine constraints?
Is there any good practice related to dynamic_cast error handling (except not using it
Is it good practice to have more than one try{} catch{} statement per method?
Is it a good practice to define DataContracts in an enterprise level assembly and

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.