Error (Csla.DataPortalException:DataPortal Update failed)

Error (Csla.DataPortalException:DataPortal Update failed)

Old forum URL: forums.lhotka.net/forums/t/4599.aspx


maqinfo posted on Wednesday, April 02, 2008

Hi

I am using CSLA 3.5 beta 2 in mine new WPF project.

I have 4 projects in mine solutions

1) OTWPF( Windows Presentation Foundation Application)

2) OTBIZLIB  (Business Library which uses CSLA reference and also OTLinq project reference)

3) OTLINQ (A LINQ Project which uses LINQ to Sql class and also have csla reference)

4) WCFHost (WCF Service library project, All files in this project are imported from sample Project Traker project and have made change in config files)

When I am trying to save the New Record

I am getting this error

{"DataPortal.Fetch failed ()"}

{"Principal must be of type BusinessPrincipal, not System.Security.Principal.GenericPrincipal"}

I am not able to get clue where i am going wrong. Please help

RockfordLhotka replied on Wednesday, April 02, 2008

Your app is configured to use CSLA custom authentication, so the data portal is passing the client-side principal to the server. But that principal is not a valid principal (doesn't inherit from BusinessPrincipal). You need to log in (or out) before making calls through the data portal so the principal is valid (even if unauthenticated).

Odds are you know this, and already have code in your app to set the principal. But WPF makes this complicated, because it will clear the principal and/or your data call might be on a background thread where the principal isn't set.

The Using CSLA .NET 3.0 ebook discusses this principal issue and illustrates a workaround - which you can also see in the PTWpf app.

Copyright (c) Marimer LLC