Download
******************************************************************************
using System;
using System.Runtime.Serialization;
namespace EvalService
{
[DataContract]
public class Eval
{
[DataMember]
public String Id { get; set; }
[DataMember]
public String Submitter { get; set; }
[DataMember]
public String Comments { get; set; }
[DataMember]
public DateTime TimeSubmitted { get; set; }
}
}
******************************************************************************
using System;
using System.Collections.Generic;
namespace EvalService
{
public class EvalService:IEvalService
{
private List<Eval> list = new List<Eval>();
#region IEvalService Members
public void SubmitEval(Eval eval)
{
Eval evalObj = new Eval();
evalObj.Id = Guid.NewGuid().ToString();
evalObj.Submitter = eval.Submitter;
evalObj.Comments = eval.Comments;
evalObj.TimeSubmitted = DateTime.Now;
list.Add(evalObj);
}
public List<Eval> GetEvals()
{
return list;
}
public void RemoveEval(string id)
{
list.Remove(list.Find(q => q.Id.Equals(id)));
}
#endregion
}
}
******************************************************************************
using System;
using System.Collections.Generic;
using System.ServiceModel;
namespace EvalService
{
[ServiceContract]
public interface IEvalService
{
[OperationContract]
void SubmitEval(Eval obj);
[OperationContract]
List<Eval> GetEvals();
[OperationContract]
void RemoveEval(String id);
}
}
******************************************************************************
<?xml version="1.0" encoding="utf-8" ?>
<configuration>
<system.web>
<compilation debug="true" />
</system.web>
<!-- When deploying the service library project, the content of the config file must be added to the host's
app.config file. System.Configuration does not support config files for libraries. -->
<system.serviceModel>
<services>
<service behaviorConfiguration="EvalService.ServiceBehavior1"
name="EvalService.EvalService">
<endpoint address="ws" binding="wsHttpBinding" contract="EvalService.IEvalService">
<identity>
<dns value="localhost" />
</identity>
</endpoint>
<!--Default Bianding it helps other end points to exchange metadata-->
<endpoint address="mex"
binding="mexHttpBinding"
contract="IMetadataExchange" />
<!--basicHttoBinding-->
<endpoint address="basic"
binding="basicHttpBinding"
bindingConfiguration=""
contract="EvalService.IEvalService" />
<!--netTcpBinding-->
<endpoint address="net.tcp://localhost:8888/evalservice"
binding="netTcpBinding"
bindingConfiguration=""
contract="EvalService.IEvalService" />
<!--netNamedPipeBinding-->
<endpoint address="net.pipe://localhost/evalservice"
binding="netNamedPipeBinding"
bindingConfiguration=""
contract="EvalService.IEvalService" />
<host>
<baseAddresses>
<add baseAddress="http://localhost:8732/evalservice" />
</baseAddresses>
</host>
</service>
</services>
<behaviors>
<serviceBehaviors>
<behavior name="EvalService.ServiceBehavior1">
<serviceMetadata httpGetEnabled="true" />
<serviceDebug includeExceptionDetailInFaults="false" />
</behavior>
</serviceBehaviors>
</behaviors>
</system.serviceModel>
</configuration>
******************************************************************************
No comments:
Post a Comment