Hi
Can you tell me if I need to update something in my LoginManager to make it work with the new DevForce version? The Implementation of the manager looks like this:
namespace
NextStay.TallyIntegrator
{
//[DiscoverableType(DiscoverableTypeMode.KnownType)]
public class LoginManager : IEntityLoginManager
{
public IPrincipal Login(ILoginCredential credential, EntityManager entityManager)
{
// Disallow null credentials and throw a LoginException
if (credential == null)
{
throw new LoginException(LoginExceptionType.NoCredentials, "Loginoplysninger mangler");
}
//return error if loginmanager is null
if (entityManager == null)
throw new LoginException(LoginExceptionType.NoLoginManager, "Loginmanager findes ikke.");
var user = entityManager.GetQuery<User>().FirstOrDefault(u => u.Id == credential.UserName);
//user does not exist
if (user == null)
throw new LoginException(LoginExceptionType.InvalidUserName, "Bruger '" + credential.UserName + "' findes ikke.");
//wrong password
if (user.Password != credential.Password)
throw new LoginException(LoginExceptionType.InvalidPassword, "Forkert password.");
// types implementing IPrincipal.
GenericIdentity identity = new GenericIdentity(credential.UserName);
GenericPrincipal principal = new GenericPrincipal(identity, new string[] { });
return principal;
}
public void Logout(IPrincipal principal, EntityManager entityManager)
{
// No special processing needed.
}
}
}
But when using the code now, I get this error on the client
The formatter threw an exception while
trying to deserialize the message: There was an error while trying to deserialize
parameter http://ideablade.com/EntityModehLoginResult. The InnerException
message was ‘Element ‘http:!fideablade.com/EntityModel:Principal’ contains data
of the
‘http://schemas.datacontract.org/2004/O7/System.Security.Principal:GenericPrinci
pal 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.