public void Dispose()
 {
     if (adminService != null)
     {
         try { adminService.Dispose(); }
         catch { }
     }
     adminService = null;
 }
Exemplo n.º 2
0
        public static OrganizationServiceProxy GetCrmServiceClientFromConnectionString(string connectionString)
        {
            var cs = ConnectionStringParser.Parse(connectionString);

            var client = new ManagedTokenOrganizationServiceProxy(new Uri(new Uri(cs.Url), "/XRMServices/2011/Organization.svc"), new ClientCredentials {
                UserName = { UserName = cs.Username, Password = cs.Password }
            });

            return(client);
        }
Exemplo n.º 3
0
        // ReSharper disable once UnusedMember.Global
        public static OrganizationServiceProxy GetOrganizationServiceProxy(Configuration config, Action <OrganizationServiceProxy> enableProxyTypes = null)
        {
            OrganizationServiceProxy proxy;

            if (config.EndpointType == AuthenticationProviderType.ActiveDirectory &&
                config.OrganizationServiceManagement != null)
            {
                proxy = new ManagedTokenOrganizationServiceProxy(config.OrganizationServiceManagement, config.Credentials);
            }
            else
            {
                proxy = GetProxy <IOrganizationService, OrganizationServiceProxy>(config);
            }

            enableProxyTypes?.Invoke(proxy);

            return(proxy);
        }