question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Is possible to customize OpenIdDictApplication adding a new field?

See original GitHub issue

Dear,

Our needs is to add a new field on OpenIddictApplication. We try to customize that entity, create an ef migration, update database schema, and referencing the new class (MyApplication that inherit from OpeniddictApplication<int>) when we need an instance of OpeniddictApplicationManager<MyApplication>(); till here everything ok.

But when we use dependency injection to get ApplicationManager like scope.ServiceProvider.GetRequiredService<OpenIddictApplicationManager<MyApplication>>(); It fail with error

No service for type ‘OpenIddict.Core.OpenIddictApplicationManager`1[BusinessManagerService.AuthServer.Models.MyApplication]’ has been registered.

Then i try to register in different way the service type required but i have to implement store, logger, etc.

So, exist an easier way to extend OpeniddictApplication?

Issue Analytics

  • State:closed
  • Created 6 years ago
  • Comments:11 (3 by maintainers)

github_iconTop GitHub Comments

1reaction
kevinchaletcommented, Sep 6, 2017
public class MyApplication : OpenIddictApplication<long, MyAuthorization, MyToken>
{
    public bool IsReserved { get; set; }
}
public class MyAuthorization : OpenIddictAuthorization<long, MyApplication, MyToken> { }
public class MyScope : OpenIddictScope<long> { }
public class MyToken : OpenIddictToken<long, MyApplication, MyAuthorization> { }
services.AddOpenIddict<MyApplication, MyAuthorization, MyScope, MyToken>();
services.AddDbContext<ApplicationDbContext>(options =>
{
    options.UseSqlServer(configuration["Data:DefaultConnection:ConnectionString"]);
    options.UseOpenIddict<MyApplication, MyAuthorization, MyScope, MyToken, long>();
});
0reactions
broguymancommented, Jun 15, 2023

If you’re like me and ran into this issue in 2023. The way I solved the problem was to use the overload that accepts an object instead of the OpenIddictApplicationDescriptor.

Read more comments on GitHub >

github_iconTop Results From Across the Web

Custom OpenIddictApplication field always returns null
In my Worker, I create the application record if it doesn't exist, but TenantID is always inserted with null: if (await manager.
Read more >
Modules/OpenIddict | Documentation Center | ABP.IO
This module implements the domain logic and database integrations but does not provide any UI. Management UI is useful if you need to...
Read more >
modules/openiddict | Documentation Center | ABP.IO
You can create new application or edit existing applications in this page: ... OpenIddictApplications (aggregate root): Represents an OpenIddict application ...
Read more >
OpenIddict RC3 is out | Kévin Chalet's blog
To register a custom store, create an implementation of IOpenIddictApplicationStore and use services.AddOpenIddict().AddCore().
Read more >
Part 8, add a new field to an ASP.NET Core MVC app
In this section Entity Framework Code First Migrations is used to: Add a new field to the model. Migrate the new field to...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found