本文整理汇总了C#中IDocumentStore.Changes方法的典型用法代码示例。如果您正苦于以下问题:C# IDocumentStore.Changes方法的具体用法?C# IDocumentStore.Changes怎么用?C# IDocumentStore.Changes使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDocumentStore
的用法示例。
在下文中一共展示了IDocumentStore.Changes方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: OnCreate
protected override void OnCreate(Bundle bundle)
{
base.OnCreate(bundle);
Store = new DocumentStore { DefaultDatabase = "Mono", Url = "http://192.168.1.12:8080" }.Initialize();
// Set our view from the "main" layout resource
SetContentView(Resource.Layout.Main);
// Get our button from the layout resource,
// and attach an event to it
Button button = FindViewById<Button>(Resource.Id.MyButton);
Store.Changes("Mono").ForAllDocuments().Subscribe(obj => RunOnUiThread(() =>
{
var local = FindViewById<Button>(Resource.Id.MyButton);
local.Text = "changed at: " + DateTime.Now.TimeOfDay;
}));
button.Click += delegate { button.Text = string.Format("{0} clicks!", count++); };
}
示例2: Main
private static void Main(string[] args)
{
using (_store = new DocumentStore {Url = "http://localhost:8080", DefaultDatabase="Messages"}.Initialize())
{
Boostrap(args);
_store
.Changes()
.ConnectionStatusChanged +=
(sender, a) =>
Console.WriteLine("Raven Connection Status Changed to {0}", _store.Changes().Connected); ;
var sleepingSubscription =
_store
.Changes()
.ForDocument("admin/config")
.Subscribe(AdjustSleep);
var routingSubcription =
_store
.Changes()
.ForDocumentsStartingWith("routing/")
.Subscribe(
_work,
exception => Console.WriteLine("Changes Subscription Error! {0}", exception),
() => Console.WriteLine("Changes Subscription Completed Unexpectedly!")
);
while (true)
{
var input = Console.ReadLine();
if (string.IsNullOrWhiteSpace(input)) break;
var sleep = WorkerSleep > 0 ? 0 : 1000;
SetSleep(sleep);
}
routingSubcription.Dispose();
sleepingSubscription.Dispose();
}
}