本文整理汇总了C#中Microsoft.WindowsAzure.MobileServices.MobileServiceClient.GetTable方法的典型用法代码示例。如果您正苦于以下问题:C# MobileServiceClient.GetTable方法的具体用法?C# MobileServiceClient.GetTable怎么用?C# MobileServiceClient.GetTable使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Microsoft.WindowsAzure.MobileServices.MobileServiceClient
的用法示例。
在下文中一共展示了MobileServiceClient.GetTable方法的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: ConnectedChatService
public ConnectedChatService()
{
client = new MobileServiceClient(MobileServiceConfig.ApplicationUri,
MobileServiceConfig.ApplicationKey);
usersTable = client.GetTable<User>();
contentsTable = client.GetTable<PhotoContent>();
recordsTable = client.GetTable<PhotoRecord>();
}
示例2: RefreshItems
private async void RefreshItems()
{
// Verbinden zum MobileService:
MobileServiceClient mobileServiceClient = new MobileServiceClient(
"https://machapp.azure-mobile.net/",
"wpLplVeEPPeUkElYJRSPrdrrDBIPDy95"
);
// Employee Tabelle laden.
IMobileServiceTable<Employee> employeeTable = mobileServiceClient.GetTable<Employee>();
// Neuen Datensatz anlegen
Employee em = new Employee() { Firstname = "Sebastian", Lastname = "Küsters" };
// em in Datenbank speichern
await employeeTable.InsertAsync(em);
// Daten aus Tabelle Employee laden
var empList = await employeeTable.ToCollectionAsync();
// Neuen Datensatz ändern
empList.Last().Firstname = "Sebastian Update :)";
// Geänderten Datensatz speichern
await employeeTable.UpdateAsync(empList.Last());
// Ersten Datensatz löschen
await employeeTable.DeleteAsync(empList.First());
// Aktuellen Daten aus Tabelle laden
var updatedList = await employeeTable.ToCollectionAsync();
// Einfach Breakpoint setzen und die Listen vergleichen ;)
}
示例3: CreateTests
public static ZumoTestGroup CreateTests()
{
ZumoTestGroup result = new ZumoTestGroup("Misc tests");
result.AddTest(CreateFilterTestWithMultipleRequests(true));
result.AddTest(CreateFilterTestWithMultipleRequests(false));
result.AddTest(new ZumoTest("Validate that filter can bypass service", async delegate(ZumoTest test)
{
string json = "{'id':1,'name':'John Doe','age':33}".Replace('\'', '\"');
var client = new MobileServiceClient(
ZumoTestGlobals.Instance.Client.ApplicationUri,
ZumoTestGlobals.Instance.Client.ApplicationKey,
new HandlerToBypassService(201, "application/json", json));
var table = client.GetTable("TableWhichDoesNotExist");
var item = new JObject();
var inserted = await table.InsertAsync(item);
List<string> errors = new List<string>();
if (!Util.CompareJson(JObject.Parse(json), inserted, errors))
{
foreach (var error in errors)
{
test.AddLog(error);
}
test.AddLog("Error comparing object returned by the filter");
return false;
}
else
{
return true;
}
}));
result.AddTest(CreateUserAgentValidationTest());
result.AddTest(CreateParameterPassingTest(true));
result.AddTest(CreateParameterPassingTest(false));
result.AddTest(CreateOptimisticConcurrencyTest("Conflicts - client wins", (clientItem, serverItem) =>
{
var mergeResult = clientItem.Clone();
mergeResult.Version = serverItem.Version;
return mergeResult;
}));
result.AddTest(CreateOptimisticConcurrencyTest("Conflicts - server wins", (clientItem, serverItem) =>
{
return serverItem;
}));
result.AddTest(CreateOptimisticConcurrencyTest("Conflicts - Name from client, Number from server", (clientItem, serverItem) =>
{
var mergeResult = serverItem.Clone();
mergeResult.Name = clientItem.Name;
return mergeResult;
}));
result.AddTest(CreateSystemPropertiesTest(true));
result.AddTest(CreateSystemPropertiesTest(false));
return result;
}
示例4: PrepareTableAsync
private async Task PrepareTableAsync(MobileServiceClient client)
{
// Make sure the table is empty
IMobileServiceTable<Product> table = client.GetTable<Product>();
IEnumerable<Product> results = await table.ReadAsync();
foreach (Product item in results)
{
await table.DeleteAsync(item);
}
products = new Product[50];
for (int i = 0; i < 50; i++)
{
string id = Guid.NewGuid().ToString();
Product p = new Product()
{
AvailableTime = TimeSpan.FromHours(i),
Id = id,
DisplayAisle = (short)(i + 10),
InStock = i % 2 == 0,
Name = "Product" + i,
OptionFlags = (byte)i,
OtherId = i,
Price = 30.09M,
Type = i % 2 == 0 ? ProductType.Food : ProductType.Furniture,
Weight = i % 2 == 0 ? 35.7f : (float?)null,
};
products[i] = p;
await table.InsertAsync(p);
}
}
示例5: PerformUserLogin
private async void PerformUserLogin(object sender, System.Windows.Input.GestureEventArgs e)
{
username = userName.Text;
phoneNo = userPhone.Text;
if (MainPage.online == true)
{
Users user = new Users();
user.Name = username;
user.Phone_no = phoneNo;
user.uri = "uri here";
MobileService = new MobileServiceClient(
"https://shopappdata.azure-mobile.net/",
"dkwwuiuHYYQwbozjKaWRJYYpEiTjFt73"
);
userTable = MobileService.GetTable<Users>();
await userTable.InsertAsync(user);
user_id = user.Id;
MainPage.settings.Add("id", user_id);
MainPage.settings.Add("Pnumber", phoneNo);
MainPage.settings.Add("name", username);
}
else
{
// Prompt
}
// TODO: send this username and phoneno. to be added into the database
NavigationService.GoBack();
}
示例6: FinishedLaunching
public override bool FinishedLaunching (UIApplication app, NSDictionary options)
{
Forms.Init ();
// create a new window instance based on the screen size
window = new UIWindow (UIScreen.MainScreen.Bounds);
#region Azure stuff
CurrentPlatform.Init ();
Client = new MobileServiceClient (
Constants.Url,
Constants.Key);
todoTable = Client.GetTable<TodoItem>();
todoItemManager = new TodoItemManager(todoTable);
App.SetTodoItemManager (todoItemManager);
#endregion region
#region Text to Speech stuff
App.SetTextToSpeech (new Speech ());
#endregion region
// If you have defined a view, add it here:
// window.RootViewController = navigationController;
window.RootViewController = App.GetMainPage ().CreateViewController ();
// make the window visible
window.MakeKeyAndVisible ();
return true;
}
示例7: PrepareTableAsync
private async Task PrepareTableAsync(MobileServiceClient client)
{
// Make sure the table is empty
IMobileServiceTable<Product> table = client.GetTable<Product>();
IEnumerable<Product> results = await table.ReadAsync();
foreach (Product item in results)
{
await table.DeleteAsync(item);
}
for (int i = 0; i < 50; i++)
{
await table.InsertAsync(new Product()
{
AvailableTime = TimeSpan.FromHours(i),
Id = Guid.NewGuid().ToString(),
DisplayAisle = (short)(i + 10),
InStock = i % 2 == 0,
Name = "Product" + i,
OptionFlags = (byte)i,
OtherId = i,
Price = 30.09M,
Type = i % 2 == 0 ? ProductType.Food : ProductType.Furniture,
Weight = i % 2 == 0 ? 35.7f : (float?)null,
});
}
//make sure we do not have any timestamps saved for requests
await this.CacheProvider.Purge();
}
示例8: WithFilter
public void WithFilter()
{
string appUrl = "http://www.test.com/";
string appKey = "secret...";
TestServiceFilter hijack = new TestServiceFilter();
MobileServiceClient service =
new MobileServiceClient(new Uri(appUrl), appKey)
.WithFilter(hijack);
// Ensure properties are copied over
Assert.AreEqual(appUrl, service.ApplicationUri.ToString());
Assert.AreEqual(appKey, service.ApplicationKey);
// Set the filter to return an empty array
hijack.Response.Content = new JsonArray().Stringify();
service.GetTable("foo").ReadAsync("bar")
.ContinueWith (t =>
{
// Verify the filter was in the loop
Assert.That (hijack.Request.Uri.ToString(), Is.StringStarting (appUrl));
Assert.Throws<ArgumentNullException>(() => service.WithFilter(null));
}).WaitOrFail (Timeout);
}
示例9: AzureService
public AzureService()
{
//comment back in to enable Azure Mobile Services.
MobileService = new MobileServiceClient("https://javusdemands.azurewebsites.net/");
expenseTable = MobileService.GetTable<Expense>();
}
示例10: OnCreate
private ProgressBar progressBar; // Progress spinner to use for table operations
// Called when the activity initially gets created
protected override async void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Activity_To_Do);
// Initialize the progress bar
progressBar = FindViewById<ProgressBar>(Resource.Id.loadingProgressBar);
progressBar.Visibility = ViewStates.Gone;
// Create ProgressFilter to handle busy state
// Create ProgressFilter to handle busy state
var progressHandler = new ProgressHandler ();
progressHandler.BusyStateChange += (busy) => {
if (progressBar != null)
progressBar.Visibility = busy ? ViewStates.Visible : ViewStates.Gone;
};
try
{
// Check to ensure everything's setup right
PushClient.CheckDevice(this);
PushClient.CheckManifest(this);
// Register for push notifications
System.Diagnostics.Debug.WriteLine("Registering...");
PushClient.Register(this, PushHandlerBroadcastReceiver.SENDER_IDS);
CurrentPlatform.Init ();
// Create the Mobile Service Client instance, using the provided
// Mobile Service URL and key
client = new MobileServiceClient(
Constants.ApplicationURL,
Constants.ApplicationKey, progressHandler);
// Get the Mobile Service Table instance to use
todoTable = client.GetTable<TodoItem>();
textNewTodo = FindViewById<EditText>(Resource.Id.textNewTodo);
// Create an adapter to bind the items with the view
adapter = new TodoItemAdapter(this, Resource.Layout.Row_List_To_Do);
var listViewTodo = FindViewById<ListView>(Resource.Id.listViewTodo);
listViewTodo.Adapter = adapter;
// Load the items from the Mobile Service
await RefreshItemsFromTableAsync();
}
catch (Java.Net.MalformedURLException)
{
CreateAndShowDialog(new Exception ("There was an error creating the Mobile Service. Verify the URL"), "Error");
}
catch (Exception e)
{
CreateAndShowDialog(e, "Error");
}
}
示例11: OnCreate
private ProgressBar progressBar; // Progress spinner to use for table operations
// Called when the activity initially gets created
protected override async void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Activity_To_Do);
// Initialize the progress bar
progressBar = FindViewById<ProgressBar>(Resource.Id.loadingProgressBar);
progressBar.Visibility = ViewStates.Gone;
// Create ProgressFilter to handle busy state
var progressHandler = new ProgressHandler ();
progressHandler.BusyStateChange += (busy) => {
if (progressBar != null)
progressBar.Visibility = busy ? ViewStates.Visible : ViewStates.Gone;
};
try
{
// PUSH NOTIFICATIONS: Register for push notifications
System.Diagnostics.Debug.WriteLine("Registering...");
// Initialize our Gcm Service Hub
GcmService.Initialize(this);
GcmService.Register(this);
// MOBILE SERVICES: Setup azure mobile services - this is separate from push notifications
CurrentPlatform.Init ();
// Create the Mobile Service Client instance, using the provided
// Mobile Service URL and key
client = new MobileServiceClient(
Constants.ApplicationURL,
Constants.ApplicationKey, progressHandler);
// Get the Mobile Service Table instance to use
todoTable = client.GetTable<TodoItem>();
// USER INTERFACE: setup the Android UI
textNewTodo = FindViewById<EditText>(Resource.Id.textNewTodo);
// Create an adapter to bind the items with the view
adapter = new TodoItemAdapter(this, Resource.Layout.Row_List_To_Do);
var listViewTodo = FindViewById<ListView>(Resource.Id.listViewTodo);
listViewTodo.Adapter = adapter;
// Load the items from the Mobile Service
await RefreshItemsFromTableAsync();
}
catch (Java.Net.MalformedURLException)
{
CreateAndShowDialog(new Exception ("There was an error creating the Mobile Service. Verify the URL"), "Error");
}
catch (Exception e)
{
CreateAndShowDialog(e, "Error");
}
}
示例12: TodoItemManager
public TodoItemManager ()
{
client = new MobileServiceClient (
Constants.ApplicationURL,
Constants.ApplicationKey);
todoTable = client.GetTable<TodoItem> ();
}
示例13: QueryHighscoreAndUpdateTile
private async void QueryHighscoreAndUpdateTile() {
MobileServiceClient client = new MobileServiceClient("https://microchopper.azure-mobile.net/", "foobar");
JToken token = await client.GetTable("highscores").ReadAsync("$orderby=score desc&$top=1");
if (token[0] != null) {
float highscore = (float)token[0]["score"];
UpdateTileWithHighscore(highscore);
}
}
示例14: MonkeyService
public MonkeyService ()
{
CurrentPlatform.Init ();
client = new MobileServiceClient (Constants.applicationUrl, this);
// Create an MSTable instance to allow us to work with the TodoItem table
monkeyTable = client.GetTable <MonkeyItem> ();
}
示例15: MusicStoreManager
public MusicStoreManager()
{
client = new MobileServiceClient(
Constants.ApplicationURL,
Constants.GatewayURL,
Constants.ApplicationKey);
this.todoTable = client.GetTable<TodoItem>();
}