Session state in generic handlers

Thursday, February 14th, 2008

http://techleppie.wordpress.com/2006/10/01/session-state-and-generic-handlers/

The solution to my problem : IRequiresSessionState. I had never come across this interface before but it was the magic key!

According to MSDN :- Specifies that the target HTTP handler requires read and write access to session-state values. This is a marker interface and has no methods.

However, if you only require readonly access then alternatively it is better to make use of IReadOnlySessionState. This will have a performance improvement and provide more scalability.

you can implement multiple interfaces using a ‘,’ see below:

public class process : IHttpHandler, System.Web.SessionState.IReadOnlySessionState {

C# Generics - interesting article

Thursday, February 14th, 2008

http://www.willasrari.com/blog/c-generics/000191.aspx

Strategy Pattern C# .NET 3.0

Saturday, January 5th, 2008

http://www.unboxedsolutions.com/sean/archive/2005/10/23/779.aspx

Intellisense for the NHibernate XML Schemas

Friday, December 14th, 2007

http://blog.benday.com/archive/2006/01/15/3646.aspx

  1. Download the NHibernate source and go to the “src\NHibernate“ directory
  2. Copy nhibernate-configuration-2.0.xsd, nhibernate-mapping-2.0.xsd, and nhibernate-generic.xsd to the Visual Studio “schemas“ directory.  By default, the schemas directory is “C:\Program Files\Microsoft Visual Studio 8\Xml\Schemas“. or “C:\Program Files\Microsoft Visual Studio 9.0\Xml\Schemas”
  3. Restart Visual Studio

Getting many-to-many mappings working in nhibernate

Friday, December 14th, 2007

this was really useful:

http://sdesmedt.wordpress.com/2006/10/21/nhibernate-part-5-mapping-techniques-for-aggregation-many-to-one-and-many-to-many-mapping/

Getting back to NHibernate

Monday, November 19th, 2007

Going to use NHibernate for a new project:

http://www.hibernate.org/362.html

Latest docs:

http://www.hibernate.org/hib_docs/nhibernate/1.2/reference/en/html_single/

Finally after a lot of fiddling I got it working. This was useful:

http://www.theserverside.net/tt/articles/showarticle.tss?id=NHibernate

c# and timers

Thursday, August 16th, 2007

The elapsed function has to be a delegate that conforms to an ElapseEventHandler

System.Timers

timer = new Timer(1000 * 60 * 15);

timer.AutoReset = true;

timer.Elapsed += functionCall;

timer.Start();

console example:

using System;
using System.Collections.Generic;
using System.Text;
using System.Timers;

namespace TestConsole
{
class Program
{
static void Main(string[] args)
{
Timer timer = new Timer(10000);
timer.AutoReset = true;
timer.Elapsed += printHello;
timer.Start();

Timer timer2 = new Timer(1000);
timer2.AutoReset = true;
timer2.Elapsed += printGoodbye;
timer2.Start();

Console.ReadLine();
}
public static void printHello(Object sender, ElapsedEventArgs e)
{
Console.WriteLine(”hello: ” + DateTime.Now);
}

public static void printGoodbye(Object sender, ElapsedEventArgs e)
{
Console.WriteLine(”BHYE: ” + e.SignalTime.ToString());
}
}
}

C# specification location

Monday, August 6th, 2007

C:\Program Files\Microsoft Visual Studio 9.0\VC#\Specifications\1033

Just in case you forget about Arrays in c# - idiot!

Monday, July 23rd, 2007

http://msdn2.microsoft.com/en-us/library/aa288453(VS.71).aspx

Scheduling tasks on Windows Server 2003 using c#

Sunday, July 22nd, 2007

http://www.codeproject.com/csharp/TSNewLib.asp