Cozta Norhalim's profilecozta.netBlogLists Tools Help

Blog


    N-Tier and Globalization Issues

    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
     
    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 .

    Microsoft AJAX RC

    It took me 3 to 4 hours to migrate the old Atlas codes to AJAX RC. There were some issues with the Menu and Tabs, but I managed to fix them. The CollapsiblePanel doesn’t seem to work properly with FireFox if the direction property is set to horizontal. I’ve posted this problem at the CodePlex’s issue tracker. A few other important things to note:
     
    • AjaxToolkit extender and its target control must be located under the same update panel
    • JavaScript: Type.registerSealedClass is no longer supported and has been changed to Type.registerClass
    • JavaScript: Sys.TypeDescriptor.addType is no longer needed
    • Timer.tick has been changed to Timer.Tick
    • JavaScript: $(‘<control_id>’) has been changed to $get(‘<control_id>’)
    • Web Service: The following attribute must be added to any web service class so that it can be called by AJAX:
      [System.Web.Script.Services.ScriptService()]
    • For the rest, follow this guide
    I hope I’ve not missed anything. I should have jotted down everything.
     
    After migrating the codes, I did some changes to the Sub-Tabs to make use of the AJAX DropDownList. I will upload a new Release Candidate soon (RC 2). It will include supports for the PostgreSQL database as well. So stay tuned ;)