コード例 #1
0
 /// <summary>
 /// Initializes a new instance of the <see cref="ConfigServiceApplicationProxy"/> class. Use this constructor to create a new Service Application Proxy (e.g. from code on the Create page).
 /// </summary>
 /// <param name="name">The name of the Service Application Proxy to create. This name will not be localized.</param>
 /// <param name="serviceProxy">A reference to the Service Proxy class.</param>
 /// <param name="serviceEndpointUri">The endpoint uri to the service.</param>
 internal ConfigServiceApplicationProxy(string name, ConfigServiceProxy serviceProxy, Uri serviceEndpointUri)
     : base(name, serviceProxy, serviceEndpointUri)
 {
     this.loadBalancer = new SPRoundRobinServiceLoadBalancer(serviceEndpointUri);
 }
コード例 #2
0
        /// <summary>
        /// Gets an existing service proxy or creates it if it doesn't exist.
        /// </summary>
        /// <returns>An instance of this service proxy.</returns>
        internal static ConfigServiceProxy GetOrCreateServiceProxy()
        {
            ConfigServiceProxy serviceProxy = SPFarm.Local.ServiceProxies.GetValue<ConfigServiceProxy>();
            if (serviceProxy == null)
            {
                serviceProxy = new ConfigServiceProxy(SPFarm.Local);
                serviceProxy.Status = SPObjectStatus.Online;
                serviceProxy.Update();
            }

            return serviceProxy;
        }