Initially, I was facing a minor globalization issue. A glitch, I thought, and nothing more. Someone from Turkey (or somebody with a tr-TR culture installed in his or her machine or set in his or her web browser’s language setting) must have tried to visit www.covalentia.net but to no avail. The person was probably feeling frustrated and forwarded me the errors (you don’t actually have to do that because all errors are automatically logged and sent to me at errorlog@covalentia.net). After a careful inspection, I found out that it’s not really a minor issue, but a major one. I had everything wrong. The culture configuration in the web.config file is not supposed to be set to auto:en-US. This will cause everything – I mean everything – from the database connection string to date and time to follow the CultureInfo.CurrentCulture information. If your database, MySQL database for example, is an English version (mine is), it will give the following error (note the date is Turkish as well as the word "uid"):
The following error/exception has occured in the Covalentia.Net Portal - FREE C#.Net Code Generator on 16 Aralık 2006 Cumartesi 23:33:32. Please response immediately. Thank you.
GUID: 11c2ae5b-8c14-4bb3-80e5-ee837f263e27
Type: Unhandled Exception
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Keyword not supported.
Parameter name: uıd
Source: MySql.Data
Stack Trace: at MySql.Data.MySqlClient.MySqlConnectionString.ConnectionParameterParsed(Hashtable hash, String key, String value)
at MySql.Data.Common.DBConnectionString.Parse(String newConnectString)
at MySql.Data.MySqlClient.MySqlConnection.set_ConnectionString(String value)
at MySql.Data.MySqlClient.MySqlConnection..ctor(String connectionString)
at Covalentia.Core.Data.SqlDataProvider.ExecuteReader(String connectionString, Int32 databaseTypeId, String query)
at Covalentia.Core.Data.SqlDataProvider.ExecuteReader(String connectionString, Int32 databaseTypeId, String tableName, String queryExpression, Boolean executeScalar)
at Covalentia.Core.Objects.GetObject(String connectionString, Int32 databaseTypeId, Type type, String queryExpression)
at Covalentia.Core.Objects.GetObject(Type type, String queryExpression)
at Covalentia.CRUD.Read(Type type, String queryExpression)
at Covalentia.Controls.Portal.Default.InitializeSkin(Control skin)
at Covalentia.Controls.SkinControl.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
IP Address: 85.105.17.21
Raw Url: /Default.aspx
Date: 16 Aralık 2006 Cumartesi 23:33:32
The following error/exception has occured in the Covalentia.Net Portal - FREE C#.Net Code Generator on 16 Aralık 2006 Cumartesi 23:33:32. Please response immediately. Thank you.
GUID: 11c2ae5b-8c14-4bb3-80e5-ee837f263e27
Type: Unhandled Exception
Description: An unhandled exception occurred during the execution of the current web request. Please review the stack trace for more information about the error and where it originated in the code.
Exception Details: Keyword not supported.
Parameter name: uıd
Source: MySql.Data
Stack Trace: at MySql.Data.MySqlClient.MySqlConnectionString.ConnectionParameterParsed(Hashtable hash, String key, String value)
at MySql.Data.Common.DBConnectionString.Parse(String newConnectString)
at MySql.Data.MySqlClient.MySqlConnection.set_ConnectionString(String value)
at MySql.Data.MySqlClient.MySqlConnection..ctor(String connectionString)
at Covalentia.Core.Data.SqlDataProvider.ExecuteReader(String connectionString, Int32 databaseTypeId, String query)
at Covalentia.Core.Data.SqlDataProvider.ExecuteReader(String connectionString, Int32 databaseTypeId, String tableName, String queryExpression, Boolean executeScalar)
at Covalentia.Core.Objects.GetObject(String connectionString, Int32 databaseTypeId, Type type, String queryExpression)
at Covalentia.Core.Objects.GetObject(Type type, String queryExpression)
at Covalentia.CRUD.Read(Type type, String queryExpression)
at Covalentia.Controls.Portal.Default.InitializeSkin(Control skin)
at Covalentia.Controls.SkinControl.CreateChildControls()
at System.Web.UI.Control.EnsureChildControls()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Control.PreRenderRecursiveInternal()
at System.Web.UI.Page.ProcessRequestMain(Boolean includeStagesBeforeAsyncPoint, Boolean includeStagesAfterAsyncPoint)
IP Address: 85.105.17.21
Raw Url: /Default.aspx
Date: 16 Aralık 2006 Cumartesi 23:33:32
And so, I have to fix a lot of things. I can’t use the CultureInfo.CurrentCulture to display data according to the user’s culture installed (or web browser’s language setting). Instead, I have to use the following:
CultureInfo ci = CultureInfo.CreateSpecificCulture(Request.UserLanguages[0]);
For the rest, I have to use the third type of culture that is culture-insensitive – CultureInfo.InvariantCulture. So, my bad. My deepest apology goes to the Turkish person or whoever he or she might be. I had replaced the auto:en-US value with just en-US. Feel free to browse the portal. We're the FOC bunch. Covalentia is for charity ;)
That’s not all.
After the recent launch of Windows Foundation, I realized that I couldn’t create a Windows Application (WPF) using Covalentia. Covalentia is very much focusing on generating web applications on the fly – and my plan is to make Covalentia a robust platform or code generator that can support other types of applications as well, not just web application.
My mistake is just like any other programmers’ mistakes. We tend to follow examples on the net every now and then, and those examples do not necessarily follow the supposedly correct rules of programming N-Tier or enterprise level applications. And so, I have Windows.Web.UI and Windows.Web.UI.WebControls in the Business Object or Logic Layer. Oooops :|
As a result, the new release of RC 2 mentioned earlier will not happen so soon. I’m working 24/7 to restructure both the presentation and business layers. Perhaps, next year? In the meantime, enjoy your holidays ;)