I'm trying to retrieve an entity using the following code
var lead = xrmContext.LeadSet.Where(m => m.Id == guid).FirstOrDefault();
and getting a runtime error:
Unable to cast object of type 'Microsoft.Xrm.Sdk.Entity' to type 'SimsHealth.Data.Xrm.Lead'
If using OrganizationServiceProxy then we can enable proxy types.
How can I fix this if I'm using early bound classes?