Servise baglantımızı yukarıdakı koddaki gibi yapıyorsak kodumuzu asagıdkı gibi güncellememiz gerekmektedir.
serviceFactory.GetType().GetProperty("ProxyTypesAssembly").SetValue(serviceFactory, typeof(XrmServiceContext).Assembly, null);

IOrganizaton service kullanarak baglantımızı gerceklestırıyorsak ;
_serviceProxy.EnableProxyTypes(); bolumunu koda eklememız yeterlı olacaktır.
public static IOrganizationService GetCrmService()
{
try
{
IOrganizationService _crmService = null;
OrganizationServiceProxy _serviceProxy = null;
ClientCredentials _objCredentials = null;
string _strCrmURL = string.Empty;
_objCredentials = new ClientCredentials();
_objCredentials.Windows.ClientCredential = CredentialCache.DefaultNetworkCredentials;
_strCrmURL ="http://deneme:port/organizationname/XRMServices/2011/Organization.svc"
Uri organizationUri = new Uri(_strCrmURL);
Uri homeRealmUri = null;
_serviceProxy = new OrganizationServiceProxy(organizationUri, homeRealmUri, _objCredentials, null);
_serviceProxy.EnableProxyTypes();
_crmService = (IOrganizationService)_serviceProxy;
return _crmService;
}
Hiç yorum yok:
Yorum Gönder