I running this code using .net core and it produces these errors:
HttpContext.Current and HttpContext.Current.Items errors:
Anybody can help me how to fix these errors in order we can compile and run
this using .net core?
And here's the code:
namespace NHibernateUnitOfWork
{
public static class Local
{
static readonly ILocalData _data = new LocalData();
public static ILocalData Data
{
get { return _data; }
}
private class LocalData : ILocalData
{
[ThreadStatic]
private static Hashtable _localData;
private static readonly object LocalDataHashtableKey = new
object();
private static Hashtable LocalHashtable
{
get
{
if (!RunningInWeb)
{
if (_localData == null)
_localData = new Hashtable();
return _localData;
}
else
{
var web_hashtable =
HttpContext.Current.Items[LocalDataHashtableKey] as Hashtable;
if (web_hashtable == null)
{
web_hashtable = new Hashtable();
HttpContext.Current.Items[LocalDataHashtableKey] = web_hashtable;
}
return web_hashtable;
}
}
}
public object this[object key]
{
get { return LocalHashtable[key]; }
set { LocalHashtable[key] = value; }
}
public int Count
{
get { return LocalHashtable.Count; }
}
public void Clear()
{
LocalHashtable.Clear();
}
public static bool RunningInWeb
{
get { return HttpContext.Current != null; }
}
}
}
}
Thanks.
--
You received this message because you are subscribed to the Google Groups
"nhusers" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
To view this discussion on the web visit
https://groups.google.com/d/msgid/nhusers/29486d73-0277-464e-807f-dadb8c735329n%40googlegroups.com.