0
Answer

Restful WCF service Refresh Problem

Mehmet Keles

Mehmet Keles

9y
781
1
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