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;