2
我创建的自定义RegistrationFeature:ServiceStack登记
public class CustomRegistrationFeature: IPlugin
{
private string AtRestPath {get; set;}
public CustomRegistrationFeature()
{
AtRestPath = "/register";
}
public void Register (IAppHost apphost)
{
appHost.RegisterService <CustomRegistrationService>(AtRestPath);
appHost.RegisterAs <CustomRegistrationValidator, IValidator <CustomRegistration>>();
}
}
我在APPHOST配置:
Plugins.Add (new CustomRegistrationFeature());
但在元数据页有CustomRegistration和注册。 为什么? 谢谢。
更新
的CustomRegistrationService:
[DefaultRequest(typeof(CustomRegistration))]
public class CustomRegistrationService : RegistrationService
{
public object Post(CustomRegistration request)
{
//base.Post(request);
return new CustomRegistrationResponse();
}
}
的CustomRegistration(请求DTO):
[DataContract]
public class CustomRegistration : IReturn<CustomRegistrationResponse>
{
[DataMember]
public string Name{ get; set; }
}
的CustomRegistrationResponse(响应DTO):
[DataContract]
public class CustomRegistrationResponse
{
[DataMember]
public string Test { get; set; }
}
谢谢你的回答。我添加了我的CustomRegistration服务 – user2007820