Skip to content

Commit 2ff9d67

Browse files
Merge pull request #28 from Unity3dAzure/iss3
Unity UI with TSTableView. Resolves #3
2 parents b428f3e + 73ed30c commit 2ff9d67

29 files changed

+6182
-1202
lines changed

Assets/AppServices/client/IAzureMobileServiceClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@
55

66
namespace Unity3dAzure.AppServices
77
{
8+
[CLSCompliant(false)]
89
public interface IAzureMobileServiceClient
910
{
1011
MobileServiceTable<E> GetTable<E>(string tableName) where E : class;

Assets/AppServices/client/MobileServiceClient.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -14,6 +14,7 @@
1414

1515
namespace Unity3dAzure.AppServices
1616
{
17+
[CLSCompliant(false)]
1718
public class MobileServiceClient : RestClient, IAzureMobileServiceClient
1819
{
1920
public string AppUrl { get; private set; }

Assets/AppServices/http/ZumoRequest.cs

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,11 @@
11
using UnityEngine;
22
using System.Collections;
33
using RestSharp;
4+
using System;
45

56
namespace Unity3dAzure.AppServices
67
{
8+
[CLSCompliant(false)]
79
public class ZumoRequest : RestRequest
810
{
911
public ZumoRequest(MobileServiceClient client, string uri, Method httpMethod) : base(uri, httpMethod)

Assets/AppServices/table/IAzureMobileServiceTable.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,7 @@ namespace Unity3dAzure.AppServices
1212
/// List<T> Read<T>() where T : new();
1313
/// </example>
1414
/// </remarks>
15+
[CLSCompliant(false)]
1516
public interface IAzureMobileServiceTable
1617
{
1718
/// <summary>

Assets/AppServices/table/MobileServiceTable.cs

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,6 +9,7 @@
99

1010
namespace Unity3dAzure.AppServices
1111
{
12+
[CLSCompliant(false)]
1213
public class MobileServiceTable<E> : IAzureMobileServiceTable
1314
{
1415
private MobileServiceClient _client;

Assets/AppServices/table/query/CustomQuery.cs

Lines changed: 22 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,34 +1,48 @@
1-
namespace Unity3dAzure.AppServices
1+
using System;
2+
using RestSharp.Contrib;
3+
4+
namespace Unity3dAzure.AppServices
25
{
6+
[CLSCompliant(false)]
37
public class CustomQuery
48
{
59
private string _filter;
610
private string _orderBy;
11+
private UInt32 _top;
712

8-
public CustomQuery(string filter, string orderBy=null)
13+
public CustomQuery(string filter, string orderBy=null, UInt32 top=0)
914
{
10-
_filter = filter;
11-
_orderBy = orderBy;
15+
_filter = filter; // return only rows that satisty the specified filter
16+
_orderBy = orderBy; // sort column by 'desc' or 'asc' order
17+
_top = top; // return the top n entities for any query,
1218
}
1319

20+
public static CustomQuery OrderBy(string orderBy) {
21+
return new CustomQuery("", orderBy);
22+
}
23+
1424
public override string ToString()
1525
{
1626
string queryString = "";
1727
string q = "?";
1828
if (!string.IsNullOrEmpty(_filter)){
19-
queryString += string.Format("{0}$filter=({1})", q, escape(_filter));
29+
queryString += string.Format("{0}$filter=({1})", q, encode(_filter));
2030
q = "&";
2131
}
2232
if (!string.IsNullOrEmpty(_orderBy)){
23-
queryString += string.Format("{0}$orderby={1}", q, escape(_orderBy));
33+
queryString += string.Format("{0}$orderby={1}", q, encode(_orderBy));
2434
q = "&";
2535
}
36+
if (_top > 0) {
37+
queryString += string.Format("{0}$top={1}", q, _top.ToString());
38+
}
2639
return queryString;
2740
}
2841

29-
public string escape(string s)
42+
private string encode(string url)
3043
{
31-
return s.Replace(" ","%20");
44+
url = url.Replace ("'", "%27"); // replace "'" with '%27'
45+
return HttpUtility.UrlPathEncode (url); // replaces " " with '%20' and not '+'
3246
}
3347

3448
}

0 commit comments

Comments
 (0)