Possible Duplicate:
.NET: Determine the type of “this” class in its static method
Hello is there any way to call non-static GetType()
in non-static class without using typeof()
?
Here is example of my code that I'm working on.
private static ISession GetOrCreate(ISessionFactory factory)
{
if (HttpContext.Current!=null)
{
ISession session = GetExistingWebSession();
if (session == null)
{
session = OpenSessionAndAddToContext(factory);
}
else if (!session.IsOpen)
{
session = OpenSessionAndAddToContext(factory);
} return session;
}
}
private ISession GetExistingWebSession()
{
return HttpContext.Current.Items[GetType().FullName] as ISession;
}