I looked at some similar posts on this topic and did not quite find what I was looking for, so I will explain what I am doing and the problem I'm working with.
I have an MVC3 application and a class library that stores my model data. For example, the project of my domain model has the CLUser class:
public class CLUser { public int ID { get; set; } [Display(Name = "User Name")] [StringLength(50, ErrorMessage = Util.ERRORMESSAGE_STRING_LENGTH_50)] public string UserName { get; set; } public string Password { get; set; } public DateTime PasswordExpiration { get; set; } public bool LockedOut { get; set; } public string LockedOutReason { get; set; } [Display(Name = "Security Question")] public string SecurityQuestion { get; set; } [Display(Name = "Security Answer")] public string SecurityAnswer { get; set; } [Display(Name = "Current Status:")] public int Standing { get; set; } public int MerchantID { get; set; } public int PartnerID { get; set; } public DateTime CreatedDtTm { get; set; } public DateTime UpdatedDtTm { get; set; } public List<CLPermission> UserPerms { get; set; } }
Then I have a WCF service that references the same project that has the CLUser model. So, in my WCF, I have a job contract called
[OperationContract] GetUser(string userName, string password);
and thus displayed in the MVC project.
So here is the problem. I want to set the CLUser object equal to my WCF service call for GetUser. Which looks like this:
ServiceClient MyService = new ServiceClient(); CLUser Usr = MyService.GetUser(userName, password);
However, when I do, I get this error:
It is not possible to implicitly convert an Auth.CLUser type to Auth.CLUser [C: \ .... \ Auth.DLL]
If WCF and the MVC application reference the same DLL, can they use the same objects?
source share