Monthly Archives: August 2012

PRODUCTION: THINGS WILL GO WRONG! COOL WAY TO BE PREPARED

I have been developing software (besides doing other things) for many years. Even if you have put a small application on a production server with few users hitting your application, you will know that lot of unexpected things happen. People do lot of different things to tackle the problem. Most of the applications log the errors to log files (using Enterprise Library, Log4net etc.). I have seen some people installing development tools (if your IT ops people let you, of course!) with debugger!!!.

Meet the new kid on the block!

IntelliTrace changed the game for debugging. This lets you go “back in time” (I mean it) to see how an application got into its current state.

How do you take advantage of this?

        • First install the IntelliTrace onto your production server. This can be done by just extracting contents of IntelliTraceCollection.cab file to a known location (Ex: c:\IntelliTrace).
        • Create a folder (Ex: C:\LogFileLocation) where the IntelliTrace log files will be written and give appropriate write permissions.
        • Open the PowerShell window and import the IntelliTrace PowerShell module:                                                                                                                           Import-Module c:\IntelliTrace\Microsoft.VisualStudio.IntelliTrace.PowerShell.dll
        • Start collecting IntelliTrace information for your web application. Let us assume that your application pool name is “EcommercePool”, you will start capturing the information by executing the PowerShell Command Start-IntelliTraceCollectionEcommercePool
        • Run your application for sometime and create some scenarios to simulate exceptions.
        • Stop collecting, you will do this by executing the PowerShell Command: 

                                 Stop-IntelliTraceCollectionEcommercePool

double-click-file

start-debugging

vs-code
Useful Links:

http://msdn.microsoft.com/en-us/magazine/ee336126.aspx

http://msdn.microsoft.com/en-us/magazine/ee336126.aspx

ENTITY FRAMEWORK, ORACLE, INDENTITY/SEQUENCE FOR INSERTS

Unlike SQL Server, Oracle does not have the concept of Identity columns. Instead Oracle has concept of sequences. While working with current Oracle Provider for Entity Frameworks, there is no support for specifying these sequences declaratively in the designer. You will definitely have need for inserts in your application.

While performing inserts using EF, we used Oracle Client Library and we wrote functions like

Code Snippet
  1. private int GetNextPatientDocumentSequence()
  2. {
  3.     int result = 0;
  4.  
  5.     string sqlQuery = @"select  S_DOC_ID.nextval from dual";
  6.  
  7.     using (OracleConnection con = new OracleConnection(OracleConnectionString))
  8.     {
  9.         con.Open();
  10.         OracleCommand cmd = con.CreateCommand();
  11.         cmd.CommandText = sqlQuery;
  12.         object data = cmd.ExecuteScalar();
  13.         string str = data.ToString();
  14.         result = int.Parse(str);
  15.         //con.Close();
  16.     }
  17.     return result;
  18. }

 

We thought about changing the structure, i.e adding a TRIGGER for inserts and then use the EF designer to specify the id generation declaratively. Finally decided against it (for obvious design reasons).

SQL SERVER 2012 AND SEQUENCE

SQL Server 2012 introduce the concept of the SEQUENCE. If you want to write your ORM layer which supports two (Oracle and SQL Server) of the major RDBMS vendors, you should consider using this feature.

MObile STRATEGY: CHOOSING THE RIGHT APPROACH

Most of the enterprises today have to have a mobile strategy. It is not as difficult as it sounds like. You already know your business processes very well. All you have to do is, select those business processes that needs mobile enablement. Once you do that exercise, you can use existing technologies to make it happen. I wrote this blog to help those decision makers. The following table pretty much tells the whole story – I told you, it was easy

ENTITY FRAMWORK AND LEFT OUTER JOIN

It is not really very obvious on how to perform a left outer in entity framework. Almost all applications have need for left outer joins. Here is a quick post which illustrates this aspect in EF.