|
using ServerCommonLibrary;
namespace Server
{
/// <summary>
/// Service provide request/response model for any kind of services.
/// </summary>
/// <typeparam name="PROVIDER">Elaborate the request and return a response</typeparam>
/// <typeparam name="OUTPUTCHANNEL">Send the response to the client</typeparam>
public class Service<PROVIDER,OUTPUTCHANNEL> : IServiceBase
where OUTPUTCHANNEL : IChannelOutput
where PROVIDER : ServerCommonLibrary.IServiceProvider_
{
OUTPUTCHANNEL sender;
PROVIDER provider;
public Service(OUTPUTCHANNEL sender, PROVIDER provider)
{
this.sender = sender;
this.provider = provider;
}
public void ParseNewRequest(RawRequest e)
{
sender.SendResponse(provider.GetResponse(e));
}
public void Dispose()
{
if (sender != null)
{
sender.Dispose();
}
if (provider != null)
{
provider.Dispose();
}
}
}
}
|
By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.
If a file you wish to view isn't highlighted, and is a text file (not binary), please
let us know and we'll add colourisation support for it.