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

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 26, 20262026-05-26T17:10:48+00:00 2026-05-26T17:10:48+00:00

I have a problem with an Api I’m currently developing with WCF Web Api,

  • 0

I have a problem with an Api I’m currently developing with WCF Web Api, this is the thing:

I want to register several resource classes as service contracts. So I have a RootResource from which I can access ChildResource1, ChildResource2, ChildResourceN.

Essentially what I want to do is perform a serie of http operations with the following route structure:

  1. GET /RootResource/{RootResouceId}/ChildResourceN/{ChildResourceNId} (this will get the Nth ChildResource from the RootResource)

My current resource registration:

routes.MapServiceRoute<ChildResource1>("RootResource");

And my operation is annotated within the resource as follows:

[WebGet(UriTemplate = "{RootResouceId}/ChildResource1/{ChildResource1Id}")]

However this approach is not convenient for me, because all my routes need to have the same pattern, the one I mentioned above.

If I want to register another resource now, lest say ChildResource2, then:

routes.MapServiceRoute<ChildResource2>("RootResource");

Notice that the base route is the same, and WCF Web Api doesn’t allow this.

  • 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-26T17:10:48+00:00Added an answer on May 26, 2026 at 5:10 pm

    The “RootResource” passed into MapServiceRoute() has to map to a single type specified by T. So if you want to use a scheme as you deescribe you would need to create a single service contract and map everything onto that service contract. Fro the description I am not certain of {RootResouceId} maps to a specific item of a given type, ie all types are the same, in which cases it makes sense to put them in one contract or different types, in which case I would make this part of the service mapping, ie

    routes.MapServiceRoute<ChildResource1>("RootResource/Child1");
    routes.MapServiceRoute<ChildResource2>("RootResource/Child2");
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a problem with API call on Facebook Graph API. This API call
I have a problem with a Javascript request to the Google Map Api Web
Hi I am recently work with Leaves api and I have problem with this
I want to display place details from this json: I have problem with parse
I have this problem, that usually api entry point works fine: https://www.google.com/analytics/feeds/accounts/default but when
I have a problem. I want to use the facebook api and make a
I have a problem with jodatime api. I can't understand why this test doesn't
i have following problem: I have a class Foo which encapsulates a web-api. the
I want to use Rapidshare api for my website, and I have the problem.
I have a bit of a problem. I wrote an API a long time

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.