.NET Core 版本中的 TypeScript API
TypeScript API in .NET Core version
.NET Core 的 ABP 模板是否具有 Javascript-API 中列出的功能?
更重要的是,.NET Core 版本是否可以生成与我的服务器端实体对应的动态代理(services.ts)?
是的,它支持核心版本的所有功能。但是没有动态代理创建。您在 Angular 版本中使用 abp.ajax 进行应用服务请求。
abp.ajax({
url: AppConsts.remoteServiceBaseUrl + '/AbpUserConfiguration/GetAll',
method: 'GET',
}
}).done(result => {
//....
});
nswag 生成服务的使用示例;
constructor(
injector: Injector,
private _accountService: AccountServiceProxy,
private _router: Router,
private readonly _loginService: LoginService
) {
super(injector);
}
save(): void {
this.saving = true;
this._accountService.register(this.model)
.finally(() => { this.saving = false; })
.subscribe((result:RegisterOutput) => {
if (!result.canLogin) {
this.notify.success(this.l('SuccessfullyRegistered'));
this._router.navigate(['/login']);
return;
}
//Autheticate
this.saving = true;
this._loginService.authenticateModel.userNameOrEmailAddress = this.model.userName;
this._loginService.authenticateModel.password = this.model.password;
this._loginService.authenticate(() => { this.saving = false; });
});
}
是的,.NET Core 的 ABP 模板具有 Javascript-API 中列出的所有功能。
ABP 不生成动态代理。推荐工具 used by the ABP team 是 NSwag:
We are using nswag to generate typescript service proxied. Nswag uses swagger endpoint to get service definitions and creates typescript classes automatically. Since there is such a great tool, we didn't want to work on that.
.NET Core 的 ABP 模板是否具有 Javascript-API 中列出的功能?
更重要的是,.NET Core 版本是否可以生成与我的服务器端实体对应的动态代理(services.ts)?
是的,它支持核心版本的所有功能。但是没有动态代理创建。您在 Angular 版本中使用 abp.ajax 进行应用服务请求。
abp.ajax({
url: AppConsts.remoteServiceBaseUrl + '/AbpUserConfiguration/GetAll',
method: 'GET',
}
}).done(result => {
//....
});
nswag 生成服务的使用示例;
constructor(
injector: Injector,
private _accountService: AccountServiceProxy,
private _router: Router,
private readonly _loginService: LoginService
) {
super(injector);
}
save(): void {
this.saving = true;
this._accountService.register(this.model)
.finally(() => { this.saving = false; })
.subscribe((result:RegisterOutput) => {
if (!result.canLogin) {
this.notify.success(this.l('SuccessfullyRegistered'));
this._router.navigate(['/login']);
return;
}
//Autheticate
this.saving = true;
this._loginService.authenticateModel.userNameOrEmailAddress = this.model.userName;
this._loginService.authenticateModel.password = this.model.password;
this._loginService.authenticate(() => { this.saving = false; });
});
}
是的,.NET Core 的 ABP 模板具有 Javascript-API 中列出的所有功能。
ABP 不生成动态代理。推荐工具 used by the ABP team 是 NSwag:
We are using nswag to generate typescript service proxied. Nswag uses swagger endpoint to get service definitions and creates typescript classes automatically. Since there is such a great tool, we didn't want to work on that.