Sorry for bringing it up again. I am using ASPNETZero version 5.0.0 (ASPNET Core + Angular). I wrote comments in my interface (ILibraryAppService) but it won't appear on Swagger. Please help me to figure out this.
/// <summary>Get Single Category object with its children.</summary>
/// <param name="categoryId">CategoryId</param>
/// <param name="language">Language Code in 3 characters</param>
/// <returns>Success</returns>
/// <exception cref="SwaggerException">A server side error occurred.</exception>
/// <param name="cancellationToken">A cancellation token that can be used by other objects or threads to receive notice of cancellation.</param>
Task<CategoryOutputWithLanguage> ApiCategoryGetAsync(string categoryId, string tenantId, string language = null, CancellationToken cancellationToken = default(CancellationToken));
<cite>ismcagdas: </cite> Hi,
- Can you try writing your comments on AppService interface, not in the AppService class.
- You can use Swagger's DocumentFilter for that. An example would be,
public class FilterRoutesDocumentFilter : IDocumentFilter { public void Apply(SwaggerDocument swaggerDoc, SchemaRegistry schemaRegistry, IApiExplorer apiExplorer) { swaggerDoc.paths["/api/services/app/role/GetRoleForEdit"].post = null; } }
I hope these help.
Hello,
For the first question, I figured out that I can use AbpSession to get UserId and TenantId. But to get the token, how to do that?
However, for the second question, I got some clue of injecting IConfigurationRoot into the constructor of my Service in ApplicationProject. But when I inject it, I got the unexpected error:
Please help me.
<cite>ismcagdas: </cite> Hi @Khai,
No, it is not supported yet. We will work on it for the next releases.
OK I will be waiting for this feature. Thank you.
Hello, The error appears at runtime (it means I can compile it successfully). Is that a bug?
thx we want to have the calendar features on new metronic theme.
hi, I am also waiting for V5 as our project need features of V5. hope that you release ASAP. not sure if it will be available next Monday, 20 Nov?
Hello, these are my files.
1. AppUrlServiceBase
public abstract class AppUrlServiceBase : IAppUrlService, ITransientDependency
{
public abstract string EmailActivationRoute { get; set; }
public abstract string PasswordResetRoute { get; set; }
protected readonly IWebUrlService WebUrlService;
protected readonly ITenantCache TenantCache;
protected AppUrlServiceBase(IWebUrlService webUrlService, ITenantCache tenantCache, IConfigurationRoot appConfigurationRoot)
{
WebUrlService = webUrlService;
TenantCache = tenantCache;
this.Initialize(appConfigurationRoot);
}
private void Initialize(IConfigurationRoot appConfigurationRoot)
{
EmailActivationRoute = appConfigurationRoot["WebUIConfig:EmailActivationRoute"];
PasswordResetRoute = appConfigurationRoot["WebUIConfig:PasswordResetRoute"];
}
public string CreateEmailActivationUrlFormat(int? tenantId)
{
return CreateEmailActivationUrlFormat(GetTenancyName(tenantId));
}
public string CreatePasswordResetUrlFormat(int? tenantId)
{
return CreatePasswordResetUrlFormat(GetTenancyName(tenantId));
}
public string CreateEmailActivationUrlFormat(string tenancyName)
{
var activationLink = WebUrlService.GetSiteRootAddress(tenancyName).EnsureEndsWith('/') + EmailActivationRoute + "?userId={userId}&confirmationCode={confirmationCode}";
if (tenancyName != null)
{
activationLink = activationLink + "&tenantId={tenantId}";
}
return activationLink;
}
public string CreatePasswordResetUrlFormat(string tenancyName)
{
var resetLink = WebUrlService.GetSiteRootAddress(tenancyName).EnsureEndsWith('/') + PasswordResetRoute + "?userId={userId}&resetCode={resetCode}";
if (tenancyName != null)
{
resetLink = resetLink + "&tenantId={tenantId}";
}
return resetLink;
}
private string GetTenancyName(int? tenantId)
{
return tenantId.HasValue ? TenantCache.Get(tenantId.Value).TenancyName : null;
}
}
2. AngularAppUrlService
public class AngularAppUrlService : AppUrlServiceBase
{
public override string EmailActivationRoute { get; set; }
public override string PasswordResetRoute { get; set; }
public AngularAppUrlService(
IConfigurationRoot appConfigurationRoot,
IWebUrlService webUrlService,
ITenantCache tenantCache
) : base(
webUrlService,
tenantCache,
appConfigurationRoot
)
{
}
}
3. MvcAppUrlService (I don't see this file)
4. NullAppUrlService
public class NullAppUrlService : IAppUrlService
{
public static IAppUrlService Instance { get; } = new NullAppUrlService();
private NullAppUrlService()
{
}
public string CreateEmailActivationUrlFormat(int? tenantId)
{
throw new NotImplementedException();
}
public string CreatePasswordResetUrlFormat(int? tenantId)
{
throw new NotImplementedException();
}
public string CreateEmailActivationUrlFormat(string tenancyName)
{
throw new NotImplementedException();
}
public string CreatePasswordResetUrlFormat(string tenancyName)
{
throw new NotImplementedException();
}
}
For the first question, after I added setter to both of the override fields, I see that the instance of AppUrlService is NullAppUrlService and I cannot use it. Please help me to figure out that.