// Collection of code snippets by Arne Vajhøj // (likely posted to comp.os.vms/INFO-VAX, INFO-TPU, MACRO32, eksperten.dk, newz.dk, LinkedIn or other place sometime between 1990 and now) using System; using System.Collections.Generic; using System.Linq; using System.ServiceModel; using System.ServiceModel.Web; namespace WS.WCF { [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single,ConcurrencyMode=ConcurrencyMode.Single)] public class RepoService : IRepoService { private WS.DataService ds = new WS.DataService(); public Data GetOne(string id) { return Data.Import(ds.GetOne(int.Parse(id))); } public List GetAll() { return ds.GetAll().Select(o => Data.Import(o)).ToList(); } public void Add(Data o) { ds.Add(Data.Export(o)); } } }