It’s not uncommon for us to have are generated types in one assembly and have a plugin that uses the code that in another assembly. When doing that CRM doesn’t do well with resolving the classes.
To work around this you can give CRM a hint by setting the ProxyTypeAssembly. To do this you must first get a reference to the IProxyTypeAssemblyProvider – we typically do this by casting the IOrganizationServiceFactory instance we get to that type and go from there. Here’s an example of a helper method to get the Organization Service and setup the ProxyTypeAssembly prior to creation of the service instance.
public IOrganizationService CreateService(Guid? userID)
var factory = ServiceProvider.GetService(typeof(IOrganizationServiceFactory))
var proxyProvider = factory as IProxyTypesAssemblyProvider;
proxyProvider.ProxyTypesAssembly = ProxyTypeAssembly;
ProxyTypeAssembly in this example would need to be the assembly that contains your generated classes. Clearly I’ve stripped out any error handling and other good stuff from this method but you get the general idea.