EF Net Core does not support nvarchar

I got this problem earlier today and i could swore it only happens for .net core 2.0. The message looks something like this :-

Data type 'nvarchar' is not supported in this form" after scaffolding from database 

After my model is binded or built, it throws this exception. I change

///
  entity.Property(e => e.Comments)
                .HasColumnName("Comments")
                .HasColumnType("nvarchar"); // No size specifier 
to

  entity.Property(e => e.Comments)
                .HasColumnName("Comments")
                .HasColumnType("nvarchar(4000)"); // <- add="" span="" this="">

And it was working. Do not think this affect a single table, it affects ALL table. So please find and replace all.

Not really sure what is the work about. Maybe i should try it on .net core 2.1.1 etc.

Hope this helps.



Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm