Answered by:

Owin PasswordHash Column data type change

Question

I am implementing Open Authentication in existing project. This project uses SQL database where password field as Varbinary [byte[] in c#]. Owin doesn't allows to save password in byte array. It internally uses string. When i am changing it to NVarchar,
it works but when I change it to Varbinary it gives exception.

Schema specified is not valid. Errors:

(26,12) : error 2019: Member Mapping specified is not valid. The type 'Edm.String[Nullable=True,DefaultValue=,MaxLength=Max,Unicode=True,FixedLength=False]' of member 'PasswordHash' in type

Code used for conversion of data type is

modelBuilder.Entity<ApplicationUser>().Property(x => x.PasswordHash).HasColumnType("nvarchar");
its workingbut when I use