DZone
Thanks for visiting DZone today,
Edit Profile
  • Manage Email Subscriptions
  • How to Post to DZone
  • Article Submission Guidelines
Sign Out View Profile
  • Post an Article
  • Manage My Drafts
Over 2 million developers have joined DZone.
Log In / Join
Please enter at least three characters to search
Refcards Trend Reports
Events Video Library
Refcards
Trend Reports

Events

View Events Video Library

Zones

Culture and Methodologies Agile Career Development Methodologies Team Management
Data Engineering AI/ML Big Data Data Databases IoT
Software Design and Architecture Cloud Architecture Containers Integration Microservices Performance Security
Coding Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks
Culture and Methodologies
Agile Career Development Methodologies Team Management
Data Engineering
AI/ML Big Data Data Databases IoT
Software Design and Architecture
Cloud Architecture Containers Integration Microservices Performance Security
Coding
Frameworks Java JavaScript Languages Tools
Testing, Deployment, and Maintenance
Deployment DevOps and CI/CD Maintenance Monitoring and Observability Testing, Tools, and Frameworks

Modernize your data layer. Learn how to design cloud-native database architectures to meet the evolving demands of AI and GenAI workkloads.

Secure your stack and shape the future! Help dev teams across the globe navigate their software supply chain security challenges.

Releasing software shouldn't be stressful or risky. Learn how to leverage progressive delivery techniques to ensure safer deployments.

Avoid machine learning mistakes and boost model performance! Discover key ML patterns, anti-patterns, data strategies, and more.

Trending

  • Comparing SaaS vs. PaaS for Kafka and Flink Data Streaming
  • Subtitles: The Good, the Bad, and the Resource-Heavy
  • How to Format Articles for DZone
  • Develop a Reverse Proxy With Caching in Go

Add Service Reference - How to Avoid Generating Already Existing Classes

By 
Gil Fink user avatar
Gil Fink
·
Apr. 29, 10 · News
Likes (0)
Comment
Save
Tweet
Share
25.9K Views

Join the DZone community and get the full member experience.

Join For Free

Today I was asked how to avoid generating an already existing client class when we use the Add Service Reference menu item in Visual Studio.Add Service Reference – How to Avoid Generating Already Existing Objects

The Problem

In the e-mail I got the question was regarding the use of ValidationResults (from the Validation Application Block) as a return type for a WCF Service. When they try to Add Service Reference to the service it is generating a new ValidationResults class for the use in the client side.

How to Avoid This Problem?

You need to reference the assembly that holds the ValidationResults in the client’s project. Since by default the Add Service Reference reuses the types in all the referenced assemblies this will disable the generation of ValidationResults class. If you want to disable this feature or to be able to specify the referenced assemblies you can first open the Add Service Reference menu and then click the Advanced button:

Add Service Reference

In the Service Reference Settings view you can check or uncheck the Reuse types in referenced assemblies checkbox or specify the only referenced assemblies to search with the Reuse types in specified referenced assemblies radio button:

Service Reference Setting

Summary

In order to avoid generation of classes in the proxy that is generated by WCF's Add Service Reference we need to add reference to the DLL which include those classes in the client assembly. Another way to do that is to use the svcutil.exe with the parameter /reference:<file path> were file path is the location of the DLL which you want to reuse its classes. I hope it will help you.

 

Published at DZone with permission of Gil Fink, DZone MVB. See the original article here.

Opinions expressed by DZone contributors are their own.

Partner Resources

×

Comments
Oops! Something Went Wrong

The likes didn't load as expected. Please refresh the page and try again.

ABOUT US

  • About DZone
  • Support and feedback
  • Community research
  • Sitemap

ADVERTISE

  • Advertise with DZone

CONTRIBUTE ON DZONE

  • Article Submission Guidelines
  • Become a Contributor
  • Core Program
  • Visit the Writers' Zone

LEGAL

  • Terms of Service
  • Privacy Policy

CONTACT US

  • 3343 Perimeter Hill Drive
  • Suite 100
  • Nashville, TN 37211
  • support@dzone.com

Let's be friends:

Likes
There are no likes...yet! 👀
Be the first to like this post!
It looks like you're not logged in.
Sign in to see who liked this post!