Mehmet Keles

Mehmet Keles

  • NA
  • 4
  • 3.5k

Restful WCF service Refresh Problem

Dec 5 2014 2:02 AM
I made a project in Windows Phone 8.1 to connect Remot SQL server via Restful WCF service, I can take all table from the server, and insert a row to table. After insert to table, I call All table again but last inserted row isnt be shown.
These are my codes,

[ServiceContract]
public interface IService1
{
[OperationContract]
[WebGet(UriTemplate = "GetData",
             RequestFormat=WebMessageFormat.Json,                                                   ResponseFormat=WebMessageFormat.Json)]
List<tblKullanicilar> GetData();


public class Service1:IService1
{

public DataClasses1DataContext data { get; set; }


List<tblKullanicilar> IService1.GetData()
{
data
= new DataClasses1DataContext();

var q = (from a in data.GetTable<tblKullanicilar>() select a).ToList<tblKullanicilar>(); data.Dispose(); data = null; return q;

}

And Calling the service...

private
async Task CallService()
{

listbox1
.ItemsSource = null;
HttpClient httpClient = new System.Net.Http.HttpClient();
HttpRequestMessage request = new HttpRequestMessage(HttpMethod.Get, "http://localhost:18901/Service1.svc/GetData");
HttpResponseMessage response = await httpClient.SendAsync(request);
string data = await response.Content.ReadAsStringAsync();
var sonuc = JsonConvert.DeserializeObject<Kullanici[]>(data);
listbox1
.ItemsSource sonuc;
listbox1
.UpdateLayout();
sonuc = null;
data
= null;


}

Anyone has an idea?
Thank you in advance