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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T22:51:16+00:00 2026-05-22T22:51:16+00:00

I may be looking for a non-existent holy grail here, but it’s worth a

  • 0

I may be looking for a non-existent holy grail here, but it’s worth a shot. For starters, here’s a quick overview of our architecture:

  • Data Access: Repository classes that interact with SQL Server via
    Entity Framework
  • Business Logic: Manager classes invoke the data layer and map the data to Domain Models
  • Domain Models: POCOs that represent our domain
  • Service Library/Service Facade: Exposes CRUD operations for the POCOs
  • Presentation: ASP.NET MVC (v2, but could be moved to v3 if needed — we’re still early in our project)

The problem we’re looking to solve is how to automatically create client-side validation to handle basic issues like required fields, min and max length, numeric ranges, etc. — just your basic first-line-of-defense stuff.

If we were to use DataAnnotations on the Domain Model POCOs (which sounds appealing at first), we could let jQuery’s unobtrusive validation do the work for us. To make it work, we would have to reference the Domain Model library in both the Service and Presentation layers because DataAnnotations don’t get passed over WCF. Unfortunately, we need to re-use the WCF service in several application and if we went that route, we’d be likely to create version-lock issues.

So we can’t reference the Domain Model on both sides of the service boundary and we don’t want to move the definition of the validation rules to the presentation layer, because future apps may consume the same services and validation will be needed there as well.

That leaves us looking for another way to pass validation rules (or validation metadata, if you prefer) that is defined with the Domain Models over WCF to the client app.

I know it sounds like we want to have our cake and eat it, too. If there isn’t a reasonable solution, we’ll bite the bullet and duplicate validation logic. I think that’s more desirable than tightly coupling our application tiers.

Given the scenario above, how would you handle client-side validation and still avoid duplicating logic?

EDIT:

Thanks for the thoughts so far. There’s one more aspect to this that I realized I forgot to include when talking about DataAnnotations: We looked into using reflection to obtain the annotations and return them via a method call to a separate service, but that won’t work because they aren’t marked as Serializable and therefore can’t be returned over WCF.

  • 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-22T22:51:17+00:00Added an answer on May 22, 2026 at 10:51 pm

    WCF doesn’t deal with client-side validation, because it can’t know the capabilities of the client on the other end of the service. If you want to do something like this you’re either going to need to:

    1. Write extra functions into your WCF service that give your clients a way to request the validation rules in some format and then implement them using some custom code.

    2. Your client will need to implement its own validation logic.

    It would be a killer feature if WCF could pass validation rules over to the client like you want, but it just can’t. 🙁

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

Sidebar

Related Questions

This may be silly, but I'm looking for so-called 'real life' examples of software
What I am looking may not be readily available. If so please let me
It may be the case this is only possible through looping, but who knows.
May be obvious but I tried searching and can't figure it out. I am
May I know if there is any way to remove non-alphabetical symbols from a
this may seem like a stupid question, but it is stumping me nontheless. I'm
I am looking for a quick way to share code snippets between developers. Visual
This is very programming related but a somewhat non-programming question. I am performing image
I have some contract text that may change. It is currently (non live system)
I searched though the internet but could not found what i was looking for,

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.