private static void ValidateClientModel(IWcfClientModel clientModel, ComponentModel model) { Type contract; if (model != null) { contract = model.Service; } else if (clientModel.Contract != null) { contract = clientModel.Contract; } else { throw new FacilityException("The client endpoint does not specify a contract."); } if (clientModel.Endpoint == null) { throw new FacilityException("The client model requires an endpoint."); } if ((model != null) && (clientModel.Contract != null) && (clientModel.Contract != model.Service)) { throw new FacilityException(string.Format( "The client endpoint contract {0} conflicts with the expected contract {1}.", clientModel.Contract.FullName, model.Service.FullName)); } }
private static void ObtainServiceContract(ComponentModel model, IWcfClientModel clientModel) { var serviceContract = clientModel.Contract ?? model.Services.Where(service => WcfUtils.IsServiceContract(service)).Single(); model.ExtendedProperties[WcfConstants.ServiceContractKey] = serviceContract; }
private static ChannelCreator CreateChannelCreatorInternal <TModel>( IKernel kernel, IWcfClientModel clientModel, ComponentModel model, out IWcfBurden burden) where TModel : IWcfClientModel { var channelBuilder = kernel.Resolve <IChannelBuilder <TModel> >(); return(channelBuilder.GetChannelCreator((TModel)clientModel, model.GetServiceContract(), out burden)); }
protected void ConfigureChannelFactory(ChannelFactory channelFactory, IWcfClientModel clientModel, IWcfBurden burden) { BindChannelFactoryAware(channelFactory, kernel, burden); var extensions =new ServiceEndpointExtensions(channelFactory.Endpoint, kernel) .Install(burden, new WcfEndpointExtensions(WcfExtensionScope.Clients)); if (clientModel != null) { extensions.Install(clientModel.Extensions, burden); extensions.Install(clientModel.Endpoint.Extensions, burden); } }
protected void ConfigureChannelFactory(ChannelFactory channelFactory, IWcfClientModel clientModel, IWcfBurden burden) { var extensions = new ChannelFactoryExtensions(channelFactory, Kernel) .Install(burden, new WcfChannelExtensions()); var endpointExtensions = new ServiceEndpointExtensions(channelFactory.Endpoint, true, Kernel) .Install(burden, new WcfEndpointExtensions(WcfExtensionScope.Clients)); if (clientModel != null) { extensions.Install(clientModel.Extensions, burden); endpointExtensions.Install(clientModel.Extensions, burden); endpointExtensions.Install(clientModel.Endpoint.Extensions, burden); } burden.Add(new ChannelFactoryHolder(channelFactory)); }
private static ChannelCreator CreateChannelCreator(IKernel kernel, ComponentModel model, IWcfClientModel clientModel, out IWcfBurden burden) { ValidateClientModel(clientModel, model); var createChannelDelegate = createChannelCache.GetOrAdd(clientModel.GetType(), clientModelType => { return((CreateChannelDelegate)Delegate.CreateDelegate(typeof(CreateChannelDelegate), createChannelMethod.MakeGenericMethod(clientModelType))); }); var channelCreator = createChannelDelegate(kernel, clientModel, model, out burden); if (channelCreator == null) { throw new CommunicationException("Unable to generate the channel creator. " + "Either the endpoint could be be created or it's a bug so please report it."); } return(channelCreator); }
private static void ValidateClientModel(IWcfClientModel clientModel, ComponentModel model) { if (clientModel.Endpoint == null) { throw new FacilityException("The client model requires an endpoint."); } var contract = clientModel.Contract ?? model.GetServiceContract(); if (contract == null) { throw new FacilityException("The service contract for the client endpoint could not be determined."); } if (model.Services.Contains(contract) == false) { throw new FacilityException(string.Format( "The service contract {0} is not supported by the component {0} or any of its services.", clientModel.Contract.FullName, model.Implementation.FullName)); } }