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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 12, 20262026-05-12T09:42:26+00:00 2026-05-12T09:42:26+00:00

In WCF land, you can specify a Namespace prefix for anything that has a

  • 0

In WCF land, you can specify a Namespace prefix for anything that has a [DataContract] like so:

[DataContract(Namespace="MyApp")] public class whatever...

However if you wanted to apply a common namespace to ALL data contracts assembly-wide, you can use the ContractNamespaceAttribute:

/* in AssemblyInfo.cs */
[assembly: ContractNamespace("MyApp", ClrNamespace = "MyApp")]

/* in whatever.cs */
[DataContract] public class whatever...

Thats great, works fine. Now over on the ServiceContract side, I can do the same Namespace setup on the service interface:

[ServiceContract(Namespace="MyApp")] public interface whateverService...

But is there something comparable to [assembly: ContractNamespace] that can be used to set the Namespace for all [ServiceContract]s? I’d really like to avoid having to set it manually for however many services, its nice having it in 1 place for the data contracts.
Since there is an assembly level namespace attribute for the data contracts, i’d hope there is one for the service contracts too…

  • 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-12T09:42:26+00:00Added an answer on May 12, 2026 at 9:42 am

    No, you cannot – you have to be very explicit in WCF and you have to explicitly set things like namespaces on each and every ServiceContract. I would probably even do it on each and every DataContract as well – just to be clear about what I am doing.

    It’s a good thing, though! Being explicit also makes your intentions clear – trust me, in a complex system, that helps !

    Marc

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

Sidebar

Related Questions

My WCF-RIA DomainService has an insert method that looks like this: public void InsertWidget(WidgetDef
In WCF you can define a contract using the [DataContract] and [DataMember] attributes, like
WCF has a rich security model, I hope everyone can agree upon that as
A WCF web service with the right class and method attributes can be accessed
What WCF configuration settings makes WCF service, so that I can access as old
In WCF some of the settings are written as class attributes. I would like
For WCF I need to specify that the known type for any IEnumerable<T> is
Monotouch/WCF: why cannot override the wcf binding default timeout setting: public class MyServiceClient :
Does WCF RIA services supports custom methods? also in which dll can i find
WCF generates complex types as external xsd files. How can I embed these definitions

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.