Ejemplo n.º 1
0
        public static void AddInstanceContextMode(this ServiceHostBase host, InstanceContextMode mode)
        {
            ServiceHostData data = GetServiceHostData(host);

            if (data != null)
            {
                data.ServiceInstanceContextMode = mode;
            }
        }
Ejemplo n.º 2
0
        public static void AddConcurrencyMode(this ServiceHostBase host, ConcurrencyMode mode)
        {
            ServiceHostData data = GetServiceHostData(host);

            if (data != null)
            {
                data.ServiceConcurrencyMode = mode;
            }
        }
Ejemplo n.º 3
0
        public static void AddServiceType(this ServiceHostBase host, Type t)
        {
            ServiceHostData data = GetServiceHostData(host);

            if (data != null)
            {
                data.ServiceType = t;
            }
        }
Ejemplo n.º 4
0
        public static ServiceHostData GetServiceHostData(this ServiceHostBase host)
        {
            ServiceHostData data = null;

            if (!serviceHostDataDictionary.TryGetValue(host.Description.Name, out data))
            {
                data = new ServiceHostData();
                serviceHostDataDictionary.TryAdd(host.Description.Name, data);
            }
            return(data);
        }
Ejemplo n.º 5
0
        public static void SetBehaviors(this ServiceHostBase host)
        {
            ServiceHostData data = GetServiceHostData(host);

            if (data != null)
            {
                foreach (IServiceBehavior beh in host.Description.Behaviors)
                {
                    data.ServiceBehaviors.Add(beh.ToString());
                }
            }
        }
Ejemplo n.º 6
0
        public static ConcurrencyMode GetConcurrencyMode(this ServiceHostBase host)
        {
            ServiceHostData data = GetServiceHostData(host);

            if (data != null)
            {
                return(data.ServiceConcurrencyMode);
            }
            else
            {
                Debug.WriteLine("Error, no data for this service");
            }
            return(ConcurrencyMode.Single);
        }
Ejemplo n.º 7
0
        public static Type GetServiceType(this ServiceHostBase host)
        {
            ServiceHostData data = GetServiceHostData(host);

            if (data != null)
            {
                return(data.ServiceType);
            }
            else
            {
                Debug.WriteLine("Error, no data for this service");
            }
            return(null);
        }
Ejemplo n.º 8
0
        public static IEnumerable <string> GetServiceBehaviors(this ServiceHostBase host)
        {
            ServiceHostData data = GetServiceHostData(host);

            if (data != null)
            {
                return(data.ServiceBehaviors);
            }
            else
            {
                Debug.WriteLine("Error, no data for this service");
            }
            return(null);
        }
Ejemplo n.º 9
0
        public static InstanceContextMode GetInstanceContextMode(this ServiceHostBase host)
        {
            ServiceHostData data = GetServiceHostData(host);

            if (data != null)
            {
                return(data.ServiceInstanceContextMode);
            }
            else
            {
                Debug.WriteLine("Error, no data for this service");
            }
            return(InstanceContextMode.PerSession);
        }