2012-10-05 58 views
2

有趣的是,在使用和不使用IReturn時,元顯示的顯示方式不同。 當IReturn實施時,我想知道如何構建DTO來修剪元數據輸出?ServiceStack IReturn和元數據

enter image description here

代碼

namespace Backbone.Todos { 
//Without IReturn -------------------------- 
[Route("/todos","POST")] //add 
[Route("/todos/{id}","POST")] //edit 
public class Todo { 
    public long Id { get; set; } 
    public string Content { get; set; } 
    public int Order { get; set; } 
    public bool Done { get; set; } 
} 
//----------------------------------------- 
[Route("/todos","GET")] //list 
public class TodoList { 
} 
//----------------------------------------- 
[Route("/todos/{id}","DELETE")]//delete 
public class DeleteTodo { 
    public int Id { get; set; } 
} 
//----------------------------------------- 
[Route("/todos/reset")] //reset 
public class ResetTodos { 
} 

......

現在samething,但IReturn <>,元數據看起來很奇怪。在圖片中注意List`1和雙Todos。

namespace Backbone.Todos { 
//Implementing IReturn--------------------- 
[Route("/todos","POST")] //add 
[Route("/todos/{id}","POST")] //edit 
public class Todo : IReturn<Todo> { 
    public long Id { get; set; } 
    public string Content { get; set; } 
    public int Order { get; set; } 
    public bool Done { get; set; } 
} 
//----------------------------------------- 
[Route("/todos","GET")] //list 
public class TodoList : IReturn<List<Todo>> { 
} 
//----------------------------------------- 
[Route("/todos/{id}","DELETE")]//delete 
public class DeleteTodo : IReturnVoid { 
    public int Id { get; set; } 
} 
//----------------------------------------- 
[Route("/todos/reset")] //reset 
public class ResetTodos : IReturnVoid{ 
} 
//----------------------------------------- 
...... 

回答

3

使用New API的元數據頁面已經在ServiceStack的HEAD版本中修復。您現在可以分解回購,否則將在週末部署新版本的ServiceStack。

相關問題