In the Java World, we have a set of library, Commons, from Apache. They provide a lot of cores functions such as email, logging and validations. In our .Net World, the open source community build a set of Commons Library. They provide a lot of cores functions, such as ORM, CSV Parser and validations. Those are different from the java version. Anyway, there are a strong set of functions. They are useful for building your own web framework. Such as, Logging and CSV Parser are essential functions for a web framework.
I got a lot of error from a LINQ DataContext, such as "Invalid attempt to call Read when reader is closed" . That is because I was using a singleton for DataContext in a multi-threads.
The codes like that:
That is not very thread-safe. A thread will close the DataContext, but others threads are still using DataContext. Then it will throw the error above.
I changed the DataContext in a pre-thread. I initialize the DataContext in each thread. The errors are gone! You also can do the DataContext in a pre-object. That is simpler.
I am implementing a Windows Service. I did a foolish mistake. I opened the design view of windows service and drag-and-drop the Timer from toolbar. Because I need the windows service to execute some code periodically. I found the timer won't triggered at all. I found that is Timer in Windows.Forms. It never works in Windows Service. You need to create a timer of System.Timers. Like the example following:
I went to the training event for Windows Azure Platform as a part of Bizspark camp. That is a great event. Thank you, Microsoft. They organized this event for the start-up like us.
The sessions are very useful and informative too! The speaker, Steve Nagy, did a great job. We got a lot of information about Azure today!
I am interested to use Azure SQL and Compute. They are Platform as a Service. Basically, I just need to deploy the website via Visual Studio to Azure Compute and run SQL in Azure SQL. They will handle all load balancing and OS Patching. That is good for the start up companies like us. We have not a dedicated server team to do those things I can scale in or out the Azure Compute instances when the load of website changes.
The most interesting thing is Azure SQL. For Azure Compute, they charge the number of instances you used and the size of each instance. But they only charge the storage of database in Azure SQL. They will do replication and load balancing behind the scene. They won't charge CPU Usage. I don't need to scale up the server when the load is increasing. Azure SQL should give more CPU and memory resources to the SQL server I use. They can handle the load without charge. That is good for web application will query the database a lot and run some expensive queries.