public static ServiceImplementSchema GetServiceImplementSchema(Type serviceImplementType)
        {
            ServiceImplementSchema schema = null;
            Int32 hashcode = serviceImplementType.GetHashCode();

            if (!_ServiceImplementSchemaTable.TryGetValue(hashcode, out schema))
            {
                lock (_ServiceImplementTableLock)
                {
                    if (!_ServiceImplementSchemaTable.TryGetValue(hashcode, out schema))
                    {
                        schema = ServiceModelSchema.SchemaLoadSource.GetServiceImplementSchema(serviceImplementType);
                        if (schema != null)
                        {
                            _ServiceImplementSchemaTable.TryAdd(hashcode, schema);
                        }
                        else
                        {
                            throw ExceptionCode.UnloadServiceSchema.NewException();
                        }
                    }
                }
            }
            return(schema);
        }
예제 #2
0
        public ServiceImplementSchema GetServiceImplementSchema(Type serviceImplementType)
        {
            ServiceImplementSchema schema = new ServiceImplementSchema();

            schema.ImplementType   = serviceImplementType;
            schema.InstantiateMode = InstantiateMode.EachCall;

            Object[] attributes = serviceImplementType.GetCustomAttributes(typeof(ServiceImplementAttribute), true);
            if (attributes.Length > 0)
            {
                var attribute = attributes[0] as ServiceImplementAttribute;
                schema.InstantiateMode = attribute.InstantiateMode;
            }
            return(schema);
        }