So I want to connect to my Azure Sql Database using in a unity project, I used this code provided in the readme of app services Github project:
public class AzureConnect : MonoBehaviour {
private MobileServiceClient _client;
private MobileServiceTable<Score> _table;
// Use this for initialization
void Start () {
_client = new MobileServiceClient("https://myService.azurewebsites.net"); // <- add your app url here.
_table = _client.GetTable<Score>("Score");
ReadItems();
}
private void ReadItems()
{
StartCoroutine(_table.Read<Score>(OnReadItemsCompleted));
}
private void OnReadItemsCompleted(IRestResponse<Score[]> response)
{
if (!response.IsError)
{
Debug.Log("OnReadCompleted: " + response.Url + " data: " + response.Content);//content shows the content of the table properly
Score[] items = response.Data;//Data is always null
Debug.Log("Todo items count: " + items.Length);
}
else
{
Debug.LogWarning("Read Error Status:" + response.StatusCode + " Url: " + response.Url);
}
}
}
The code works perfectly and connects to my DB just fine but for some reason the response DATA is always null although the response CONTENT returns a string with the data in the scores table just fine Any Idea what could be the problem?
PS: the url of the App service is not the real one I use just for demo purpose.