You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Invalid cast from 'System.UInt64' to 'System.Guid'. System.InvalidCastException: Invalid cast from 'System.UInt64' to 'System.Guid'. at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider) at Dapper.SqlMapper.Parse[T](Object value) in C:\projects\dapper\Dapper\SqlMapper.cs:line 2969 at Dapper.SqlMapper.<ExecuteScalarImplAsync>d__641.MoveNext() in C:\projects\dapper\Dapper\SqlMapper.Async.cs:line 1193`
this is my ConfigureServices:
public void ConfigureServices(IServiceCollection services)
{
services.ConfigureDapperConnectionProvider<MySqlConnectionProvider>(Configuration.GetSection("DapperIdentity"))
.ConfigureDapperIdentityCryptography(Configuration.GetSection("DapperIdentityCryptography"))
.ConfigureDapperIdentityOptions(new DapperIdentityOptions { UseTransactionalBehavior = false }); //Change to True to use Transactions in all operations
services.AddIdentity<CustomUser, CustomRole>(x =>
{
x.Password.RequireDigit = false;
x.Password.RequiredLength = 1;
x.Password.RequireLowercase = false;
x.Password.RequireNonAlphanumeric = false;
x.Password.RequireUppercase = false;
})
.AddDapperIdentityFor<MySqlConfiguration, Guid>()
.AddDefaultTokenProviders();
services.AddMvc();
CustomUser and CustomRole:
public class CustomUser : DapperIdentityUser<Guid>
{
public string FirstName { get; set; }
public CustomUser() { }
public CustomUser(string userName) : base(userName) { }
}
public class CustomRole : DapperIdentityRole<Guid>
{
public CustomRole() { }
public CustomRole(string roleName) : base(roleName)
{
}
}
I changed the table for identityUser (MySql) like so:
CREATE TABLE IF NOT EXISTS `identityuser` (
`Id` CHAR(36) NOT NULL,
`Username` varchar(256) NOT NULL,
`Email` varchar(256) DEFAULT NULL,
`FirstName` varchar(256) DEFAULT NULL,
`EmailConfirmed` bit(1) NOT NULL,
`PasswordHash` longtext,
`SecurityStamp` varchar(38) DEFAULT NULL,
`PhoneNumber` varchar(50) DEFAULT NULL,
`PhoneNumberConfirmed` bit(1) NOT NULL,
`TwoFactorEnabled` bit(1) NOT NULL,
`LockoutEnd` datetime DEFAULT NULL,
`LockoutEnabled` bit(1) NOT NULL,
`AccessFailedCount` int(11) NOT NULL,
PRIMARY KEY (`Id`)
) ENGINE=InnoDB AUTO_INCREMENT=6 DEFAULT CHARSET=utf8;
Is that a mistake from my side or is that a general bug?
EDIT
if i register someone the data is insert in the database, but i get the error message from above
The text was updated successfully, but these errors were encountered:
hi,
i get the error:
Invalid cast from 'System.UInt64' to 'System.Guid'. System.InvalidCastException: Invalid cast from 'System.UInt64' to 'System.Guid'. at System.Convert.DefaultToType(IConvertible value, Type targetType, IFormatProvider provider) at Dapper.SqlMapper.Parse[T](Object value) in C:\projects\dapper\Dapper\SqlMapper.cs:line 2969 at Dapper.SqlMapper.<ExecuteScalarImplAsync>d__64
1.MoveNext() in C:\projects\dapper\Dapper\SqlMapper.Async.cs:line 1193`this is my ConfigureServices:
CustomUser and CustomRole:
I changed the table for identityUser (MySql) like so:
Is that a mistake from my side or is that a general bug?
EDIT
if i register someone the data is insert in the database, but i get the error message from above
The text was updated successfully, but these errors were encountered: