An application runs on a SQL Server database that runs on a specific timezone, and the entire application EF code and stored procedures rely on that timezone with DateTime.Now and GETDATE().
That same application is being migrated to another SQL Server, which runs on another different timezone that cannot be changed.
What are the strategies to make small changes to this application code to make this migration feasible?
Procedures: create a
getdatefix()function wrapping thegetdate()and adding the timezone logic. Replacegetdate()withgetdatefix()in all stored procedures.EF: is there a way to set timezone from application code? Is there a way to override function mapping so we can override the
DateTime.Nowmapping fromgetdate()togetdatefix()?
Any other ideas?
Thanks!