wcf - parameters in service route -


working on wcf webhttp project , had question on parameters in route composition.

i have 2 services - project service (that allows user add , view projects) , item service allows users view items inside project. there can multiple items in single project.

i have urls of form

localhost//projects//addproject

localhost//projects//{projectid}//item//additem

localhost//projects//{projectid}//item//getitem//{itemid}

i have twoservices itemservice , projectservice. itemservice has methods additem , getitem projectservice has methods addproject

how declare these services in global routes? tried

routetable.routes.add(new serviceroute("projects/{projectid}/item", new webservicehostfactory(), typeof(itemservice))); gives me error

i can add code projectservice maintainability of code have both projectservice , itemservice

just suggestion:

  • you can create controller called, say: "projectcontroller".
  • add methods it, call service(s), say:

    • a. addproject()
    • b. additem(int projectid)
    • c. getitem(int projectid, int itemid)

and can call them way want:

localhost//project//addproject

localhost//project//additem//{projectid}

localhost//project//getitem//{projectid}//{itemid}


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -