Click or drag to resize

ServiceHostInterfaceProxyGenerator Class

Interface proxy generator that builds a proxy that has a default constructor and does not copy over non-inherited type attributes.
Inheritance Hierarchy
SystemObject
  BaseProxyGenerator
    InterfaceProxyWithTargetGenerator
      InterfaceProxyWithTargetInterfaceGenerator
        Autofac.Multitenant.Wcf.DynamicProxyServiceHostInterfaceProxyGenerator

Namespace:  Autofac.Multitenant.Wcf.DynamicProxy
Assembly:  Autofac.Multitenant.Wcf (in Autofac.Multitenant.Wcf.dll) Version: 4.0.0-CI-234
Syntax
public class ServiceHostInterfaceProxyGenerator : InterfaceProxyWithTargetInterfaceGenerator

The ServiceHostInterfaceProxyGenerator type exposes the following members.

Constructors
  NameDescription
Public methodServiceHostInterfaceProxyGenerator
Initializes a new instance of the ServiceHostInterfaceProxyGenerator class.
Top
Properties
  NameDescription
Protected propertyAllowChangeTarget (Inherited from InterfaceProxyWithTargetInterfaceGenerator.)
Protected propertyGeneratorType (Inherited from InterfaceProxyWithTargetInterfaceGenerator.)
Public propertyLogger (Inherited from BaseProxyGenerator.)
Protected propertyProxyGenerationOptions (Inherited from BaseProxyGenerator.)
Protected propertyScope (Inherited from BaseProxyGenerator.)
Top
Methods
  NameDescription
Protected methodAddMapping (Inherited from BaseProxyGenerator.)
Protected methodAddMappingForISerializable (Inherited from BaseProxyGenerator.)
Protected methodAddMappingForTargetType (Inherited from InterfaceProxyWithTargetInterfaceGenerator.)
Protected methodAddMappingNoCheck (Inherited from BaseProxyGenerator.)
Protected methodAddToCache (Inherited from BaseProxyGenerator.)
Protected methodBuildClassEmitter (Inherited from BaseProxyGenerator.)
Protected methodCheckNotGenericTypeDefinition (Inherited from BaseProxyGenerator.)
Protected methodCheckNotGenericTypeDefinitions (Inherited from BaseProxyGenerator.)
Protected methodCompleteInitCacheMethod (Inherited from BaseProxyGenerator.)
Protected methodCreateFields (Inherited from BaseProxyGenerator.)
Protected methodCreateInterceptorsField (Inherited from BaseProxyGenerator.)
Protected methodCreateOptionsField (Inherited from BaseProxyGenerator.)
Protected methodCreateSelectorField (Inherited from BaseProxyGenerator.)
Protected methodCreateTypeAttributes
Adds custom attributes to the generated type.
(Overrides InterfaceProxyWithTargetGenerator.CreateTypeAttributes(ClassEmitter).)
Protected methodEnsureOptionsOverrideEqualsAndGetHashCode (Inherited from BaseProxyGenerator.)
Public methodEquals
Determines whether the specified object is equal to the current object.
(Inherited from Object.)
Protected methodFinalize
Allows an object to try to free resources and perform other cleanup operations before it is reclaimed by garbage collection.
(Inherited from Object.)
Public methodGenerateCode (Inherited from InterfaceProxyWithTargetGenerator.)
Protected methodGenerateConstructor (Inherited from BaseProxyGenerator.)
Protected methodGenerateConstructors (Inherited from BaseProxyGenerator.)
Protected methodGenerateParameterlessConstructor (Inherited from BaseProxyGenerator.)
Protected methodGenerateStaticConstructor (Inherited from BaseProxyGenerator.)
Protected methodGenerateType (Inherited from InterfaceProxyWithTargetGenerator.)
Protected methodGetContributorForAdditionalInterfaces (Inherited from InterfaceProxyWithTargetInterfaceGenerator.)
Protected methodGetFromCache (Inherited from BaseProxyGenerator.)
Public methodGetHashCode
Serves as the default hash function.
(Inherited from Object.)
Public methodGetType
Gets the Type of the current instance.
(Inherited from Object.)
Protected methodGetTypeImplementerMapping
Gets the contributors for generating the type definition.
(Overrides InterfaceProxyWithTargetGenerator.GetTypeImplementerMapping(Type, Type, IEnumerableITypeContributor, INamingScope).)
Protected methodHandleExplicitlyPassedProxyTargetAccessor (Inherited from BaseProxyGenerator.)
Protected methodInit (Inherited from InterfaceProxyWithTargetGenerator.)
Protected methodInitializeStaticFields (Inherited from BaseProxyGenerator.)
Protected methodMemberwiseClone
Creates a shallow copy of the current Object.
(Inherited from Object.)
Protected methodObtainProxyType (Inherited from BaseProxyGenerator.)
Public methodToString
Returns a string that represents the current object.
(Inherited from Object.)
Top
Fields
  NameDescription
Protected fieldtargetField (Inherited from InterfaceProxyWithTargetGenerator.)
Protected fieldtargetType (Inherited from BaseProxyGenerator.)
Top
Remarks

The standard InterfaceProxyWithTargetInterfaceGenerator builds a proxy object that has no default constructor. While a default constructor is not useful from an actual proxying standpoint, the WCF service host will only host object types that have default constructors. As such, if we want to start the service host with a proxy type, the proxy type has to have a default constructor.

Also, the standard InterfaceProxyWithTargetInterfaceGenerator generates a type that copies all of the non-inherited attributes over from the target interface, which causes WCF to choke on the ServiceContractAttribute, which is already on the service contract interface. This generator overrides GetTypeImplementerMapping(Type, Type, IEnumerableITypeContributor, INamingScope) to change the set of code generating contributors to make a slimmer proxy that WCF hosting will accept.

See Also