Skip to content

Do not require to implement own BaseLinkHelper #1

@andresmoschini

Description

@andresmoschini

Currently it is required to register a custom version of ILinkHelper in startup.

Maybe it is possible to configure AspNet.HypermediaApi Linking with a helper, something like:

public void ConfigureServices(IServiceCollection services)
{
    services.AddHypermediaApi(new AddHypermediaApiOptions() {
        GenerateToHomeAccountLink = (linkHelper, httpContext) => {
            var username = httpContext?.User?.Identity?.Name;
            return
                username == null ? linkHelper.ToAction<HomeController>(x => x.AccountHome(TemplateParameter.Create<string>()))
                : linkHelper.ToAction<HomeController>(x => x.AccountHome(username));
        }
    });

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type
    No fields configured for issues without a type.

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions