I'm using code-first entity framework to create tables in a SQL database from objects. I'd like to have control over what types my variables are once they are in the SQL table.
For example, I have a table with a CountryName column. Currently, it has the data type nvarchar(MAX). I'd like for the data type to be nvarchar(40) to save memory.
I can do this manually in SSMS, but it'll take me a few hours to do this for all my tables. I'm looking for a way to do this in code.
Thanks in advance!
EDIT: I also want control whether or not my data type can accept NULL. So, I want to change all my data types (e.g., int, nvarchar, DateTime) to not accept NULL.