locked
WCF : web client and service RRS feed

  • Question

  • I am creating a WCF service with service based database that is accessible by a web client ( HTML, JS,...) . i am new with WCF i did some tutorials to create a service here is the code : 

    ------ IService.cs

    [ServiceContract]
        public interface IService
        {
            [OperationContract]
            void CreateUser(Info user);
            [OperationContract]
            List<Info> GetUsers();
            [OperationContract]
            void RemoveUser(string id);
      }

    -------- Service.cs

    [ServiceBehavior(InstanceContextMode=InstanceContextMode.Single)]
        public class Service : IService
        {
            List<Info> users = new List<Info>();
            #region IService Members
            public void CreateUser(Info user)
            {
                user.Id = Guid.NewGuid().ToString();
                users.Add(user);
            }
            public List<Info> GetUsers()
            {
                return users;
            }
            public void RemoveUser(string id)
            {
                users.Remove(users.Find(e => e.Id.Equals(id)));
            }
            #endregion

    how can i link the database to this service, and is there a tutorial on how to create a simple Web client .

    Thanks 

    Wednesday, February 8, 2012 7:11 PM

Answers

All replies