Xunit using F#

by sunil ravulapalli /17. May 2014 06:01 /.net /Comments (0)

Create new F# Library project. Install Xunit from Nuget Create a class called MyTest.fs like this

module MyTests  
open Xunit

type myTest1() = class

    []
    member self.myTest() =
       Assert.Equal(1, 1);

end  

Build it, and then, just right click any where on the myTest1 method and choose Run Test. In the Test Explorer Window you should see the test run succesfully.

Understanding how SqlConnection opens and closes connections

by sunil ravulapalli /15. October 2013 07:49 /.net /Comments (0)
When you do conn.open() IIS opens a physical connection to DB. 
When u do conn.close() IIS moves to the connection pool. 
If some request is made using the same connection string IIS will use it. 
In the same app if you do:
conn.open()
conn.close()
and then  
conn1.open() 
conn1.close()
IIS will use the same physical connection.
But if you do: 
conn1.open() 
conn2.open()
IIS will open two physical connections. 
You can return the 2 connections to pool by doing
conn1.close() 
conn2.close()
 
If you do not close connections conn1 and conn2 will remain open for a long time and wont return to connection pool. 
So if there are new connection like conn3 and conn4, IIS will have a total 4 physical connections. If your website hits traffic on black friday, there will be hundreds of such connections which will crash your site :).

Could not load file or assembly 'Oracle.DataAccess, Version=1.102.4.0, Culture=neutral, PublicKeyToken=89b483f429c47342'

by sunil ravulapalli /18. May 2012 21:14 /.net /Comments (0)

This happens if you developed your Application using an older oracle client(oracle 10) and deployed it to a machine using a newer oracle client (11g) Copy the new Oracle.DataAccess.dll to the bin in the new machine, and put this in your servers web.config under the configuration tag to pick up the new oracle client.

 

Understanding sql connections

by sunil ravulapalli /11. May 2011 21:43 /.net /Comments (0)
When you do conn.open() IIS opens a physical connection to the DB.
When you do conn.close() IIS moves the connection to the connection pool.
If some request is made using the same connection string IIS will re-use the connection from the pool.
 
Now, lets say in an App you do this:
conn.open
//Do stuff
conn.close
 
and then you do this:
conn1.open
//Do stuff
conn1.close
 
In this case, IIS uses the same physical connection.
 
But lets say if you do this:
conn1.open
conn2.open
 
IIS will open two physical connections.
 
You can return the 2 connections to pool
conn1.close
conn2.close
 
However, if u do not close the connections conn1 and conn2 will remain open for a long time(10 second is still a long time) and won't return to connection pool.
 
So if there are new connections like conn3 and conn4, IIS will have a total 4 physical connections
If your website hits traffic on black friday, there will be hundreds of such connections and your site will crash :)