Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. WCF Service doesn't return data

WCF Service doesn't return data

Scheduled Pinned Locked Moved C#
csharpdatabasemobilewcfhelp
1 Posts 1 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • M Offline
    M Offline
    Member_14830098
    wrote on last edited by
    #1

    Hello, i want to create simple mobile add using Xamarin who use WCF Service, but i have problem with return data from database. Firstly i connect database with WCF and create code: IServiceWhitewagon:

    [ServiceContract]
    public interface IServiceWhitewagon
    {

        \[OperationContract\]
        List GetCompany();
    }
    

    ServiceWhitewagon

    public class ServiceWhitewagon : IServiceWhitewagon
    {
    public ServiceWhitewagon()
    {

        }
    

    public List GetCompany()
    {
    WhitewagonEntities db = new WhitewagonEntities();
    return
    (from company in db.Company
    select new CompanyForView
    {
    idCompany = company.idCompany,
    name = company.name,
    phone = company.phone,
    adress = company.adress
    }
    ).ToList();
    }
    }

    CompanyForView

    [DataContract]
    public class CompanyForView
    {
    [DataMember]
    public int idCompany { get; set; }

        \[DataMember\]
        public string name { get; set; }
    
        \[DataMember\]
        public string adress { get; set; }
    
        \[DataMember\]
        public string phone { get; set; }
    }
    

    In next step i connect WCF with my app called AppMobileWhitewagon Screen While connect WCF I usinghttp://localhost:54308/ and i saw all created metod in WCF. Whats more i test WCF in WCT Test Client and i see data from datatable: Screen In MobileApp i have problem with show data from datatable. When in App I click on the button who should show card with data from datatable app freeze on 20 seconds and show empty card. My code in class who should get data

    public class CompanyDataStore : ItemDataStore
    {
    public CompanyDataStore()
    {
    items = zamowieniaServices.GetCompany(null).GetCompanyResult.Select(k => new Company
    {
    idCompany = k.idCompany,
    name = k.name,
    phone = k.phone,
    adress = k.adress
    }).ToList();
    }
    }

    ItemDataStore

    public abstract class ItemDataStore : IDataStore
    {
    public List items;

    1 Reply Last reply
    0
    Reply
    • Reply as topic
    Log in to reply
    • Oldest to Newest
    • Newest to Oldest
    • Most Votes


    • Login

    • Don't have an account? Register

    • Login or register to search.
    • First post
      Last post
    0
    • Categories
    • Recent
    • Tags
    • Popular
    • World
    • Users
    • Groups