locked
signature of ServiceRoute constructor, used in Thinktecture RRS feed

  • Question

  • User2012405926 posted
    I am looking at line 152-162
                // ws-trust
                if (configuration.WSTrust.Enabled)
                {
                    routes.Add(new ServiceRoute(
                        Thinktecture.IdentityServer.Endpoints.Paths.WSTrustBase,
                        new TokenServiceHostFactory(),
                        typeof(TokenServiceConfiguration))
                    );
                }
                #endregion
            }
    I look at contructor signature of ServiceRoute:
    public ServiceRoute(string routePrefix, ServiceHostFactoryBase serviceHostFactory, Type serviceType);
    
    So  I feel strange, 
    last parameter, typeof(TokenServiceConfiguration)  seems does not fit to be a Type serviceType. 
    I serach other example online, this one seems fit: 
            RouteTable.Routes.Add(new ServiceRoute(""
                new WebServiceHostFactory(), typeof(TaskService))); 
    Can anyone explain to me?
    Thanks,
    Thursday, June 12, 2014 1:04 PM

Answers

  • User-734925760 posted

    Hi,

    According to your description and the links you provided, I think the typeof(TokenServiceConfiguration) only want to get the type via the sevice name TokenServiceConfiguration. So the function below:

    public ServiceRoute(
    	string routePrefix,
    	ServiceHostFactoryBase serviceHostFactory,
    	Type serviceType
    )

    The code only want to initializes a new instance of the ServiceRoute class with the specified route prefix, service host factory, and service type.

    Foe more information, please refer to the link below:

    http://msdn.microsoft.com/en-us/library/system.servicemodel.activation.serviceroute(v=vs.110).aspx

    Hope it's useful for you.

    Best Regards,

    Michelle Ge

    • Marked as answer by Anonymous Thursday, October 7, 2021 12:00 AM
    Friday, June 13, 2014 2:34 AM