Example #1
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 RepoServiceProxy GetOrCreateServiceProxy()
        {
            RepoServiceProxy serviceProxy = SPFarm.Local.ServiceProxies.GetValue<RepoServiceProxy>();
            if (serviceProxy == null)
            {
                serviceProxy = new RepoServiceProxy(SPFarm.Local);
                serviceProxy.Status = SPObjectStatus.Online;
                serviceProxy.Update();
            }

            return serviceProxy;
        }
 /// <summary>
 /// Initializes a new instance of the <see cref="RepoServiceApplicationProxy"/> 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 RepoServiceApplicationProxy(string name, RepoServiceProxy serviceProxy, Uri serviceEndpointUri)
     : base(name, serviceProxy, serviceEndpointUri)
 {
     this.loadBalancer = new SPRoundRobinServiceLoadBalancer(serviceEndpointUri);
 }