c# - ServiceStack iterate through all request/response DTO -


how can iterate through request/response dtos setup route?

for example route this:

[route("/api/something", "get")] public class somethinggetrequest : ireturn<list<something>> {     public int somethingid { get; set; } } 

and response dto this:

public class {     public string { get; set; }     public int b { get; set; } } 

i want have service action can iterate through setup routes, , retrieve the:

  • request url
  • class name
  • request properties
  • response dto properties

is there servicstack built in way this?

in end use autogenerate extjs store/models. i'm interested in better/alternative approach.

edit:

here solution came with: gist

on /extjs/javascript route service returns extjs store/models , on /extjs/metadata route service returns zip file store/model folder can drop in newly created sencha architect project. templates based on architect v. 3.0.1.1343 produces.

this assumes route decorated this:

[route("/api/something", "get", summary="route description")] public class somethinggetrequest : ireturn<list<something>> {      [apimember(name = "somethingid", parametertype = "query", isrequired = true, datatype = "int")]     public string somethingid { get; set; }  } 

the current implementation works simple properties in request/response dtos. there room improvement...

have looked @ servicestack.api.swagger package (documented here)? sounds pretty similar want.

if swagger ui won't work out of box, use servicestack.api.swagger package , send requests /resources , related urls metadata in json format , process data according needs. or if want write in c#, consult code swaggerapiservice , swaggerresourcesservice see how retrieves dtos , routes , extracts metadata them.


Comments

Popular posts from this blog

php - regexp cyrillic filename not matches -

c# - OpenXML hanging while writing elements -

sql - Select Query has unexpected multiple records (MS Access) -