I wonder if someone have tried using WCF RIA Services in XAML based metro application. If you have any blog or sample please share.
相关问题
- How to make a .svc file write to asp.net Trace.axd
- WPF Binding from System.Windows.SystemParameters.P
- WCF Service Using Client Certificates Requires Ano
- WCF error with net.tcp "The service endpoint faile
- Xamarin. The name 'authorEntry does not exist
相关文章
- WPF MVVMLight:在ViewModel中,开子线程为ObservableCollectio
- WCF发布Windows服务 POST方式报错 GET方式没有问题 应该怎么解决?
- 关于ItemsControl的绑定问题
- Working with hmacsha256 in windows store app
- XCopy or MOVE do not work when a WCF Service runs
- XAML ComboBox SelectionChanged Fires OnLoad
- Show flyout using BottomAppBar
- Why does my ScrollViewer destroy my Grid Layout? W
As a matter of fact I did and here's the trick :)
I added a "Service Reference" to my WCF service exposing an ADO.NET Entity Framework model. The problem is that in a XAML/C# Metro app, executing the following code fails:
Here's the exception you'll get at runtime:
Ahhh, this would have been too good to be true!
As stated in the exception, you need your server calls to be asynchronous, just as in Silverlight.
Here's a sample of how you can consume a WCF RIA Service in a C# Metro App doing it the old school way:
Now using .NET 4.5 and its new await & async keywords, you can get the same result whilst avoiding your code to be chunked with all those little callback methods.
Example:
Using either of the last two methods worked fine for me :)