Current filter:
                                You should refresh the page.
                                  • 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); } }

                                1 Solution

                                Creation Date Importance Sort by

                                Implemented:


                                Additional information:

                                Starting with version 12.2.8, the XpoDataServiceV3 class will provide a virtual GetSessionCore method. For instance, you can override it as follows if you are using Domain Components (DC):

                                [C#]
                                protected override UnitOfWork GetSessionCore() { if (objectSpaceProvider != null) { XPObjectSpace os = (XPObjectSpace)objectSpaceProvider.CreateObjectSpace(); return (UnitOfWork)os.Session; } return base.GetSessionCore(); }

                                Refer to the ObjectSpace is null when using oData/XpoDataServiceV3 ticket for a complete sample project.
                                Thanks,
                                Dennis