Giter Club home page Giter Club logo

Comments (8)

project-ext avatar project-ext commented on August 25, 2024

NHibernate.Exceptions.GenericADOException: 'Failed to execute multi query[SQL: select applicatio0_.applicationuser_key as id1_30_0_, identityro2_.Id as id1_33_1_, applicatio0_1_.AccessFailedCount as acces2_30_0_, applicatio0_1_.Email as email3_30_0_, applicatio0_1_.EmailConfirmed as email4_30_0_, applicatio0_1_.LockoutEnabled as locko5_30_0_, applicatio0_1_.LockoutEndDateUtc as locko6_30_0_, applicatio0_1_.PasswordHash as passw7_30_0_, applicatio0_1_.PhoneNumber as phone8_30_0_, applicatio0_1_.PhoneNumberConfirmed as phone9_30_0_, applicatio0_1_.TwoFactorEnabled as twof10_30_0_, applicatio0_1_.UserName as user11_30_0_, applicatio0_1_.SecurityStamp as secu12_30_0_, identityro2_.Name as name2_33_1_, roles1_.UserId as useri1_31_0__, roles1_.RoleId as rolei2_31_0__ from ApplicationUser applicatio0_ inner join AspNetUsers applicatio0_1_ on applicatio0_.applicationuser_key=applicatio0_1_.Id left outer join AspNetUserRoles roles1_ on applicatio0_.applicationuser_key=roles1_.UserId left outer join AspNetRoles identityro2_ on roles1_.RoleId=identityro2_.Id where upper(applicatio0_1_.UserName)=?; select applicatio0_.applicationuser_key as id1_30_0_, claims1_.Id as id1_34_1_, applicatio0_1_.AccessFailedCount as acces2_30_0_, applicatio0_1_.Email as email3_30_0_, applicatio0_1_.EmailConfirmed as email4_30_0_, applicatio0_1_.LockoutEnabled as locko5_30_0_, applicatio0_1_.LockoutEndDateUtc as locko6_30_0_, applicatio0_1_.PasswordHash as passw7_30_0_, applicatio0_1_.PhoneNumber as phone8_30_0_, applicatio0_1_.PhoneNumberConfirmed as phone9_30_0_, applicatio0_1_.TwoFactorEnabled as twof10_30_0_, applicatio0_1_.UserName as user11_30_0_, applicatio0_1_.SecurityStamp as secu12_30_0_, claims1_.ClaimType as claim2_34_1_, claims1_.ClaimValue as claim3_34_1_, claims1_.UserId as useri4_34_1_, claims1_.UserId as useri4_34_0__, claims1_.Id as id1_34_0__ from ApplicationUser applicatio0_ inner join AspNetUsers applicatio0_1_ on applicatio0_.applicationuser_key=applicatio0_1_.Id left outer join AspNetUserClaims claims1_ on applicatio0_.applicationuser_key=claims1_.UserId where upper(applicatio0_1_.UserName)=?; select applicatio0_.applicationuser_key as id1_30_, applicatio0_1_.AccessFailedCount as acces2_30_, applicatio0_1_.Email as email3_30_, applicatio0_1_.EmailConfirmed as email4_30_, applicatio0_1_.LockoutEnabled as locko5_30_, applicatio0_1_.LockoutEndDateUtc as locko6_30_, applicatio0_1_.PasswordHash as passw7_30_, applicatio0_1_.PhoneNumber as phone8_30_, applicatio0_1_.PhoneNumberConfirmed as phone9_30_, applicatio0_1_.TwoFactorEnabled as twof10_30_, applicatio0_1_.UserName as user11_30_, applicatio0_1_.SecurityStamp as secu12_30_, logins1_.UserId as useri1_32_0__, logins1_.LoginProvider as login2_32_0__, logins1_.ProviderKey as provi3_32_0__ from ApplicationUser applicatio0_ inner join AspNetUsers applicatio0_1_ on applicatio0_.applicationuser_key=applicatio0_1_.Id left outer join AspNetUserLogins logins1_ on applicatio0_.applicationuser_key=logins1_.UserId where upper(applicatio0_1_.UserName)=?; select applicatio0_.applicationuser_key as id1_30_, applicatio0_1_.AccessFailedCount as acces2_30_, applicatio0_1_.Email as email3_30_, applicatio0_1_.EmailConfirmed as email4_30_, applicatio0_1_.LockoutEnabled as locko5_30_, applicatio0_1_.LockoutEndDateUtc as locko6_30_, applicatio0_1_.PasswordHash as passw7_30_, applicatio0_1_.PhoneNumber as phone8_30_, applicatio0_1_.PhoneNumberConfirmed as phone9_30_, applicatio0_1_.TwoFactorEnabled as twof10_30_, applicatio0_1_.UserName as user11_30_, applicatio0_1_.SecurityStamp as secu12_30_ from ApplicationUser applicatio0_ inner join AspNetUsers applicatio0_1_ on applicatio0_.applicationuser_key=applicatio0_1_.Id where upper(applicatio0_1_.UserName)=?; ]'

from nhibernate.aspnet.identity.

juliocgs avatar juliocgs commented on August 25, 2024

I'm having the same issue.

It tries to select against this "ApplicationUser" table, but it does not exists in .NET Identity Tables (as far as I know). Just created a MVC5 application with Identity Login and this table is not there.

Anyone has a clue on this?

from nhibernate.aspnet.identity.

juliocgs avatar juliocgs commented on August 25, 2024

Solved the problem by creating ApplicationUser table in the database as below:

CREATE TABLE ApplicationUser(
	applicationuser_key NVARCHAR(128) PRIMARY KEY
)

ALTER TABLE ApplicationUser WITH CHECK ADD CONSTRAINT [FK_ApplicationUser_AspNetUsers] FOREIGN KEY(applicationuser_key)
REFERENCES AspNetUsers (Id)

After this everything seems normal.

The thing is: I do not know why this table is needed.
Should I really create it myself? Is it structure complete/correct?

from nhibernate.aspnet.identity.

lnu avatar lnu commented on August 25, 2024

There are always two tables for the users: aspnetuser and one with the name of your application user class, in this case ApplicationUser. How did you create your schema? You should create it with the script generated by the ScriptGenerator from NHibernate. If you try the sample provided, you'll see what are the generated tables.

 // this NHibernate tool takes a configuration (with mapping info in)
 // and exports a database schema from it
 new SchemaExport(_configuration)
                .SetOutputFile(path)
                .Create(true, true /* DROP AND CREATE SCHEMA */);

from nhibernate.aspnet.identity.

juliocgs avatar juliocgs commented on August 25, 2024

How did you create your schema?

I created a MVC5 Application from scratch and had EF create it for me. This way ApplicationUser table is not created.

If you try the sample provided, you'll see what are the generated tables.

I'll give it a try.

Thanks.

from nhibernate.aspnet.identity.

juliocgs avatar juliocgs commented on August 25, 2024

I created an empty database and ran SchemaExport on it. All tables were created normally, including ApplicationUser.
Everything seems to work as intended with this schema.

from nhibernate.aspnet.identity.

lnu avatar lnu commented on August 25, 2024

The ApplictionUser object is used to store extra properties. All extra properties will be added to the corresponding ApplicationUser table. It's table per subclass mapping. If you don't need extra properties you can directly use IdentityUser I think.

from nhibernate.aspnet.identity.

juliocgs avatar juliocgs commented on August 25, 2024

I see, I'm really grateful.
Thanks for the help =]

from nhibernate.aspnet.identity.

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.