Lost Principal in a WPF application and OnDataPortalInitInvoke has never been calledLost Principal in a WPF application and OnDataPortalInitInvoke has never been called
Old forum URL: forums.lhotka.net/forums/t/4446.aspx
snaky posted on Monday, March 03, 2008
I'm using Xceed DataGrid in my application which obviously tries to create new data objects in a separate thread but it fails with a SecurityException. Analysis shows that a principal object has been lost. I saw in the sources of DataPortal that OnDataPortalInitInvoke is called after checking whether user can create an object. So I cannont replace the principal with my own. Is it possible to place an OnDataPortalInitInvoke call before security checking? Or maybe there's another solution?
RockfordLhotka replied on Monday, March 03, 2008
The technique used in the
Using CSLA .NET 3.0 ebook should address this issue. CSLA .NET 3.0 includes a new data portal event where you can set the principal earlier in the process.
snaky replied on Monday, March 03, 2008
You reffer to a technique about storing a principal object and then replacing an incorrect one in DataPortalInitInvoke Event. But this event is never called in my case. I'm using CSLA .NET 3.0 and in the file DataPortal.cs i see that OnDataPortalInitInvoke is called after the security checking. Am I misunderstanding something?
RockfordLhotka replied on Monday, March 03, 2008
Are you running the beta of 3.5? I'm guessing so.
Looking at the 3.5 code I see what you are talking about - and that is a bug, so thanks for helping me find it.
But in 3.0.4 there is no auth check in the data portal, so you should be OK.
snaky replied on Monday, March 03, 2008
Yes! Thank you for helping :)
So it'll be safe if I call OnDataPortalInitInvoke earlier in the code and wait for next revision of your great framework?
RockfordLhotka replied on Monday, March 03, 2008
Yes, I’ll fix this bug very soon.
Rocky
From: snaky
[mailto:cslanet@lhotka.net]
Sent: Monday, March 03, 2008 7:58 AM
To: rocky@lhotka.net
Subject: Re: [CSLA .NET] Lost Principal in a WPF application and
OnDataPortalInitInvoke has never been called
Yes! Thank you for helping :)
So it'll be safe if I call OnDataPortalInitInvoke earlier in the code and wait for
next revision of your great framework?
Copyright (c) Marimer LLC