beka

beka

  • NA
  • 6
  • 0

Data service - WCF with linq

Dec 4 2009 2:31 AM
 can somebody helps me to write little simple example  , without entity framework


I write somethin like this    but it write error

 cannot imlicitly convert type 'System.collections.generic ......'

in service1.svc.cs
[code]
   public class Service1 : IService1
    {

        private GNSCWCF.MyDataClassesDataContext MyLinqDc = new GNSCWCF.MyDataClassesDataContext();

        public class UserData
        {
        

           public int UserID { get; set; }
           public string Name { get; set; }
           public string Surname { get; set; }
            public string Birthday { get; set; }
            public string PiradiNomeri { get; set; }
            public string Adress { get; set; }
            public string Phone { get; set; }
            public string DateCreate { get; set; }


        }

        public List<UserData> GetUserData()
            {
                //IQueryable<PacientLinqDc.Pacients> query = from p in PacientLinqDc.Pacients select p;
             
             var query = from p in MyLinqDc.Users select p;
            
              return query.ToList();
            }
               
[/code]

And in IService1.cs

[code]
  [ServiceContract]
    public interface IService1
    {
       [OperationContract]
       List<GNSCWCF.Service1.UserData> GetUserData();
    }

[/code]