Giter Club home page Giter Club logo

Comments (11)

kevinchalet avatar kevinchalet commented on May 18, 2024

Have you tried the samples?

from openiddict-core.

Gillardo avatar Gillardo commented on May 18, 2024

I have not, i wanted to start with a clean project to start with, so i could follow everything. I can try a sample project, which one do i need, Server or Client?

from openiddict-core.

Gillardo avatar Gillardo commented on May 18, 2024

Right, i have narrowed the problem down, and found out what is causing the error. Not sure if this is my mistake, or whether the readme file needs to be updated. In a default webApplication, this appears in the startup.cs file.

if (env.IsDevelopment())
{
    app.UseBrowserLink();
    app.UseDeveloperExceptionPage();
    app.UseDatabaseErrorPage();
}
else
{
    app.UseExceptionHandler("/Home/Error");

    // For more details on creating database during deployment see http://go.microsoft.com/fwlink/?LinkID=615859
    try
    {
        using (var serviceScope = app.ApplicationServices.GetRequiredService<IServiceScopeFactory>()
            .CreateScope())
        {
            serviceScope.ServiceProvider.GetService<ApplicationDbContext>()
                 .Database.Migrate();
        }
    }
    catch { }
}

I have not got my site in development mode, so it is calling the Database.Migrate() method. I am not sure why the Application table is not created, because this is being called, but this is the reason.

Can someone shed some light on this?? I havent used EF7 yet, so not sure what is right/wrong

from openiddict-core.

singlewind avatar singlewind commented on May 18, 2024

Make sure your application DataSet is inside your ApplicationDbContext and the OnModelCreating has code to create the application table. If database already exists, you need create the migration code as well.

from openiddict-core.

Gillardo avatar Gillardo commented on May 18, 2024

Dbset added as tried inheriting from openid context as well as using own
and it compiles successfully.

Database didnt exist so would expect Application table to be created like
all other tables are
On 9 Jan 2016 23:41, "Yue Zhou" [email protected] wrote:

Make sure your application DataSet is inside your ApplicationDbContext and
the OnModelCreating has code to create the application table. If database
already exists, you need create the migration code as well.


Reply to this email directly or view it on GitHub
#44 (comment).

from openiddict-core.

Gillardo avatar Gillardo commented on May 18, 2024

This was an issue with the DI. All sorted now

from openiddict-core.

bouchepat avatar bouchepat commented on May 18, 2024

Can you explain how you sorted it out? Tried with new project and run the examples but still getting the same error. Invalid Applications object.

Thanks

from openiddict-core.

bouchepat avatar bouchepat commented on May 18, 2024

Might exists a better solution, but this fixed the issue:

public class ApplicationDbContext : IdentityDbContext
{
public ApplicationDbContext(DbContextOptions options)
: base(options)
{ }

    public DbSet<Application> Applications { get; set; }
}

Hopefully this can help others.

from openiddict-core.

kevinchalet avatar kevinchalet commented on May 18, 2024

Might exists a better solution, but this fixed the issue:

Nope, it's the right approach if you don't want to inherit from OpenIddictContext. It's clearly mentioned in the README:

image

from openiddict-core.

bouchepat avatar bouchepat commented on May 18, 2024

Thanks, I read the readme and it did help resolving the issue; however the readme does not mention if inheriting from OpenIddictContext the Applications table will not be created. Which is the issue reported.
If there is a reason why the table is not created when inheriting from OpenIddictContext I would be interested to know why. Thanks

from openiddict-core.

kevinchalet avatar kevinchalet commented on May 18, 2024

If there is a reason why the table is not created when inheriting from OpenIddictContext I would be interested to know why.

Hum weird. Are you sure you didn't have a pre-existing database before updating your context class to inherit from OpenIddictContext?

from openiddict-core.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.