DateTime – How to properly save and read date time in ASP.Net

There could be many ways of saving DateTime in an App. The simplest way is storing it as it is typed in by users if the website’s users are within a single country. If a website is serviced globally, confusion starts. Normally users might assume the date-time is local time. For example, if a user… Continue reading DateTime – How to properly save and read date time in ASP.Net

Design Pattern – Composite

Let’s refactor further the previous code sample using the composite pattern. See the link(https://www.dofactory.com/net/composite-design-pattern) for the details of what is a composite pattern. Let’s bring back the last code here. var availableCommands = new ICommand[] { new UpdatePrice(_stockPriceManager, stocksToRead, _appSettings.DaysToReadFromWeb), new UpdateStats(_stockPriceManager, stocksToAnalyze), new SimulateCommand(_stockPriceManager, stocksToAnalyze, _marketWatchRepository, investDay, _tradeOption, _logger, _appSettings) }; if (runOption ==… Continue reading Design Pattern – Composite

SQL Intellisense – You must use

I know some developers are good enough to code without intellisense. But I’m not as I started coding with Visual Studio so I live with intellisense from day one. Intellisense is like an iPhone to everyday people living in 21 century.  I was pretty happy with the intellisense and other intelligent support from Visual Studio… Continue reading SQL Intellisense – You must use

SQL query performance tuning

Tuning quick tips Getting the entire record before apply condition. -> Solution: Apply condition and paging before select. Using sub-query -> Solution: Turn it into join Using Table Variable being used with large data -> Solution: use Temp Table When a query performs badly, 3 things above are the most common causes I came across.… Continue reading SQL query performance tuning