Code Paste


Code Paste during the years I maintains code snippets as notes for myself.recently goes over it and thought it might be useful to some of you, so I decided to publish it on my blog. you can see my code snippet at you have to do is to fill the "By" filed with my name and click search. enjoy it
no comments

Observable.FromAsync is it the right choice?


Observable.FromAsync is it the right choice? one of the most common RX's practice is to use Observable.FromAsync for executing asynchronous IO operations. typical code may look like: Code Snippet var webClient = new WebClient(); IObservable<string> uris = ...; var dataStream = from uri in uris                     from data in Observable.FromAsync(                         () => webClient.DownloadDataTaskAsync(uri))                     select data; behind the scenes RX set a Task continuation (ContinueWith) and propagate the result through AsyncSubject, actually it is a bit complex and messy implementation combination with TPL Dataflow (.NET 4.5) may offer better solution to asynchronous...

Generic restrictions


Generic restrictions can you predict the output of the following code snippet? Code Snippet static void Main(string args) {     var b = new B();     var g = new General<B>();     g.Exec(b); }   public class A {     public void Print()     {         Console.WriteLine("A");     } } public class B:A {     public void Print()     {         Console.WriteLine("B");     } }   public class General<T>     where T:A {     public void Exec(T t)     {         t.Print();     } } first try to predict before F5 and then give it a try. you might not expect to see so...
no comments

WCF DS-based OData services + EF 6


WCF DS-based OData services + EF 6 WCF Data Services was recently shipped with support for Entity Framework 6.migration from previously version is easy and involve tooling upgrade NuGet package and replacing the inheritance of DataService<> with EntityFrameworkDataService<>. Creating a new EF 6's OData service do the following steps, in order to have EF 6's OData service up and running: Install WCF Data Services 5.6.0 RTM Tools Installer Create hosting project (usually empty ASP.NET) Install the WCF Data Services Entity Framework Provider NuGet(this is still a pre-release package so remember include pre-released packages...
no comments

ASP.NET Web API + minimal touch MEF


ASP.NET Web API + minimal touch MEF this post will offer light touching technique of introducing MEF to ASP.NET Web API. the motivation for having MEF (or any other IoC container) for Web API is for dependencies abstraction and testability. it is also easier to design your API by Contract (mining that you don't have to think about the actual implementation at design time). so why minimal touch? even those other suggestion can be found, most of them involve custom routing. the risk of alter ASP.NET Web API routing, is...

How to start working with EF 6 on VS 2012


How to start working with EF 6 on VS 2012 Entity Framework 6 is finally having a NuGet stable release (version 6.0.1), but you should be aware that start working which this version will required more than adding NuGet reference. in order to use Entity Framework 6 (on VS 2012), you have to follow those steps: install Entity Framework 6 Tools for Visual Studio 2012 you may also want to install EF Power Tools but this one is not mandatory delete...

ASP.NET Web API + Attribute based Routing


ASP.NET Web API + Attribute based Routing this post is talking about ASP.NET Web API feature which enable to extend the resource oriented paradigm of Http REST base API toward a service oriented API. be aware that the post is speaking of a pre release feature, therefore it might be subject to API changes, actually I have spent lot of time lately in order to set it right, because changed has occurs recently (with out a decent documentation). a few words about REST (Representational state transfer) API. Http was construct over the notion of resources,  represented...
no comments