No, it is not possible to create such a mapping. The decimal type on SQL Server and float or double on .NET are not compatible. This is what the exception says when you try to match, for example
modelBuilder.Entity<House>() .Property(h => h.Width) .HasColumnType("decimal");
Unfortunately, EF does not support comparisons between various primitive types. You are forced to use a .NET type that is compatible with a column type in SQL Server.
A possible (not very good) workaround is to use two properties in your model class and map only one to the database:
public class House {
Typecasting can throw exceptions if the source numbers do not match the target type, so a more complex conversion may be required.
source share