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 669321
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 14, 20262026-05-14T00:08:18+00:00 2026-05-14T00:08:18+00:00

I am curious how others would handle this situation. I have a domain layer

  • 0

I am curious how others would handle this situation. I have a domain layer that includes an Address object. I then have an application that uses this object. Additionally, there is an asp.net asmx web service that performs address validation by going out to a third party web service.

I am curious how to deal with this functionality. I don’t want to put the service reference and code to access the web service in the domain layer. It also seems wrong to put it in the application layer.

My current best solution is to create a third assembly that references the original domain layer AND the validation web service. This keeps my domain layer a bit cleaner with no external references. How would you handle this situation?

  • 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-14T00:08:19+00:00Added an answer on May 14, 2026 at 12:08 am

    Well, is validating the address part of the application (UI) logic or part of your domain requirements?

    If it’s an app function, it goes in the app layer. If it’s a core domain function, it goes in the domain layer.

    If you’re concerned about coupling – for example, if you think that you might decide to use a different address validation service in the future – then place an abstraction over it. Create an interface and a wrapper class:

    public interface IAddressValidator
    {
        bool ValidateAddress(Address address);
    }
    
    public class FooAddressValidator : IAddressValidator
    {
        private FooService service;
    
        public FooAddressValidator(FooService service)
        {
            this.service = service;
        }
    
        public bool ValidateAddress(Address address)
        {
            return service.ValidateAddress(address.StreetLine1, address.City,
                address.State, address.Country);
        }
    }
    

    Or whatever the logic is. Then make your application (or domain model) depend on IAddressValidator instead of the service itself, and fan in a concrete IAddressValidator instance from the outermost layer.

    You could put the core IAddressValidator interface in your domain model and keep the FooAddressValidator in an external assembly that’s only ever referenced by the executable. That way your domain isn’t actually dependent on the web service, but you still have address validation as part of your domain logic.

    This also makes whatever uses the address validation component a lot easier to test, since you don’t actually need to make web service calls, you can use a different MockAddressValidator instance for that.

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

Sidebar

Related Questions

I'm curious how others have solved this problem, and what problems might lurk behind
I am curious as to what others are using in this situation. I know
I am curious as to how others approach this. Writing a test ain't so
I'm curious to find out how the latest JVMs would handle garbage collecting memory
I was curious about how the MongoDB plugin for Grails would handle relationships. In
I am curious about what source versioning strategy would others apply on a java
Simple issue, actually. Just curious if others recognize the problem and perhaps have a
I'm curious how others do it, or if there's an easier way... I'm having
I was curious about how other people use the this keyword. I tend to
This is something I'm not much consistent about and always curious about what other

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.