Created per ObjectSpace is null when using oData/XpoDataServiceV3.
C#internal UnitOfWork GetSession() {
UnitOfWork uow;
if (!SessionCache.TryGetValue(this, out uow)) {
ResolveSessionEventArgs args = new ResolveSessionEventArgs();
OnResolveSession(args);
if(args.Session != null) {
uow = args.Session.Session;
}
if (uow == null){
uow = new UnitOfWork(Context.ObjectLayer);
}
SessionCache.Add(this, uow);
}
return uow;
}
protected virtual UnitOfWork GetSessionCore() {
return new UnitOfWork(Context.ObjectLayer);
}
protected virtual void OnResolveSession(ResolveSessionEventArgs args) {
if(Events[EventResolveSession] != null)
((ResolveSessionEventHandler)Events[EventResolveSession])(this, args);
}
static readonly object EventResolveSession = new object();
public event ResolveSessionEventHandler ResolveSession {
add {
Events.AddHandler(EventResolveSession, value);
}
remove {
Events.RemoveHandler(EventResolveSession, value);
}
}