New Posts New Posts RSS Feed: IEntityLoginManager Serialization Issues
  FAQ FAQ  Forum Search   Calendar   Register Register  Login Login

IEntityLoginManager Serialization Issues

 Post Reply Post Reply
Author
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Topic: IEntityLoginManager Serialization Issues
    Posted: 30-Jul-2010 at 10:30am
Back to Top
mlens View Drop Down
Newbie
Newbie
Avatar

Joined: 19-Apr-2010
Location: Australia
Posts: 7
Post Options Post Options   Quote mlens Quote  Post ReplyReply Direct Link To This Post Posted: 29-Jul-2010 at 5:23pm
Any chance you could post a sample implementation of the LoginManager under DevForce 2010? It's really confusing when you say GenericPrincipal and GenericIdentity are no longer supported but the login method of IEntityLoginManager returns IPrincipal....

Thanks
Back to Top
kimj View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 09-May-2007
Posts: 1391
Post Options Post Options   Quote kimj Quote  Post ReplyReply Direct Link To This Post Posted: 04-Jul-2010 at 6:01pm
GenericPrincipal and GenericIdentity are not types intrinsic to Silverlight.  In DevForce Silverlight 2009 we did define these types within the DF assemblies, but we dropped this in DF 2010.  (GenericPrincipal and GenericIdentity are still available in standard .NET - http://msdn.microsoft.com/en-us/library/system.security.principal.genericprincipal.aspx.) 
 
You can return any type implementing IPrincipal from an IEntityLoginManager, as long as it's defined on both client and server.
Back to Top
ting View Drop Down
IdeaBlade
IdeaBlade
Avatar

Joined: 27-Mar-2009
Location: San Francisco
Posts: 427
Post Options Post Options   Quote ting Quote  Post ReplyReply Direct Link To This Post Posted: 02-Jul-2010 at 8:26pm

We made a change to the IEntityLoginManager in DevForce 2010 (this was buried on page 28 of the Release Notes).  You should now be returning a UserBase or your own IPrincipal.  As Kim writes below, GenericPrincipal and GenericIdentity are not native to Silverlight and we no longer define them.

If you subclass from UserBase make sure to mark any properties you need on the client with the [DataMember] attribute so they will serialize.
 
If you implement your own IPrinicpal, you can make it serializable by doing the following:
  1. Have the class "implement" the IKnownType interface.  (This is a marker interface, so no actual implementation is required.)
  2. Mark the class with the [DataContract] attribute
  3. Mark each serializable property with the [DataMember] attribute.

 



Edited by ting - 09-Jul-2010 at 5:19pm
Back to Top
midnit View Drop Down
Senior Member
Senior Member
Avatar

Joined: 22-Jun-2009
Location: Charlotte
Posts: 112
Post Options Post Options   Quote midnit Quote  Post ReplyReply Direct Link To This Post Posted: 02-Jul-2010 at 9:39am
We are working on upgrading to DevForce 2010. Our IEntityLoginManager worked fine in 2009 and I expect is not the issue here but I am at a loss at what IS causing the issue. Please advise.
 
"The formatter threw an exception while trying to deserialize the message: There was an error while trying to deserialize parameter http://ideablade.com/EntityModel:LoginResult. The InnerException message was 'Element 'http://ideablade.com/EntityModel:Principal' contains data of the 'http://schemas.datacontract.org/2004/07/System.Security.Principal:GenericPrincipal' data contract. The deserializer has no knowledge of any type that maps to this contract. Add the type corresponding to 'GenericPrincipal' to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding it to the list of known types passed to DataContractSerializer.'.  Please see InnerException for more details."
Back to Top
 Post Reply Post Reply

Forum Jump Forum Permissions View Drop Down