If you look on StackOverflow you will find many questions that ask how to map one datatype in the database to another:
Convert from to string in database to boolean property Entity Framework 4.1
Nearly always the solution is to have 2 fields in the entity, with code to do the explicit conversion.
A small number of DataTypes can be mapped using the FluentAPI
and you could use custom code first conventions:
Your smallint
to int
will fall into this category but I am pretty sure float
to decimal(10, 2)
will not.
Your problem is compounded by having multiple databases with different datatypes so I don't think EF by itself is going to work very well.
I can think of two things you could try:
Create Views in each of the databases that map datatypes consistently, then reverse engineer the Entity Framework from the Views. You will also probably have to map the CUD to stored procedures then modify the Create and Update sql for each database to convert the dataypes.
OR
Look at Dapper where you have greater control over the sql and do conversions there. There are links to hybrid implementations of the repository pattern at this answer EF + Dapper Hybrid Implementation