Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

  1. Create a new Class Library to add a controller and save  in Aptify code base like "../Main/Aptify.Services/Framework/Endpoints/Implementations". you need to add Aptify.servicesFramework dll as reference in your class library. Below is sample code  to demonstrate on how to pass parameter and display parameter value.  

    Code Block
    languagec#
    linenumberstrue
    using System;
    using Aptify.Services.Framework.Endpoints;
    namespace ParamDemo
    
    {
        public class TestController : Aptify.Services.Framework.Endpoints.ServiceController
        {
            public override Aptify.Services.Framework.Endpoints.ServiceResponse ProcessRequest(Aptify.Services.Framework.Endpoints.ServiceRequestContext context)
            {
                string param1 = (string)context.ServiceParameters["param1"];    //to pass parameter1 to service request
                ServiceResponse response = new ServiceResponse();
                response.Content = new StringContent("Parameter1 having value:" + param1); // response display to client
                return response;
            }
        }
    }


    In the above code ServiceRequestsContext object Image Added

     

  2. In the above code ServiceRequestsContext object is having information about request i.e.  ControllerName, cookies,Headers, httpmethod,query parameter,AuthenticatedContext, service parameter. Service parameters are non literal values that are defined in route. miscProperties are  are used in Autherization plugin to put the results of parsing into dictionary and provide result to service request. 
    ServiceResponse  object   object provide information about response content. After building above class library you need to copy the assembly and add the reference in object repository in Aptify. 

  3. After Building your Class Library you need to add genrated assembly into  Aptify.Services.FrameWork bin folder.

  4. In Aptify you should put the controller into Object Repository  under services packages.

...