{"id":3590,"date":"2014-03-29T02:03:50","date_gmt":"2014-03-29T02:03:50","guid":{"rendered":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/system-reflection-emit-to-implement-a-webchannelfactory-for-silverlight-4-collection-of-common-programming-errors\/"},"modified":"2014-03-29T02:03:50","modified_gmt":"2014-03-29T02:03:50","slug":"system-reflection-emit-to-implement-a-webchannelfactory-for-silverlight-4-collection-of-common-programming-errors","status":"publish","type":"post","link":"https:\/\/unknownerror.org\/index.php\/2014\/03\/29\/system-reflection-emit-to-implement-a-webchannelfactory-for-silverlight-4-collection-of-common-programming-errors\/","title":{"rendered":"System.Reflection.Emit to Implement a WebChannelFactory for Silverlight 4?-Collection of common programming errors"},"content":{"rendered":"<p>This question follows upon someone else&#8217;s question because the asker never accepted or said the solution to his problem, if he found one.<\/p>\n<p>What&#8217;s the most portable way to make a Silverlight &amp; Regular .NET REST client<\/p>\n<p>If you&#8217;re familiar with WebChannelFactory from .NET, it provides a clean way to create a client to access WCF Web Http (REST) services. There is no such class in Silverlight 4, so it might be worth creating a class that acts like it.<\/p>\n<p>How would you get started in creating such as class, that creates a client that implements your service&#8217;s contract (TChannel)? I don&#8217;t know how Microsoft did this, but it looks like they somehow create a new Type at runtime to implement the interface. Would you approach doing this in Silverilght? Maybe by looking at System.Reflection.Emit and TypeBuilder.AddInterfaceImplementation?<\/p>\n<p>A more specific-to-System.Reflection.Emit question I have is, what&#8217;s the simplest way to use MethodBuilder to create a method for your TypeBuilder, if you want to use existing compiled code? It looks like you could use MethodBuilder.CreateMethodBody, however, in Silverlight 4 this does not exist.<\/p>\n","protected":false},"excerpt":{"rendered":"<p>This question follows upon someone else&#8217;s question because the asker never accepted or said the solution to his problem, if he found one. What&#8217;s the most portable way to make a Silverlight &amp; Regular .NET REST client If you&#8217;re familiar with WebChannelFactory from .NET, it provides a clean way to create a client to access [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-3590","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3590","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/comments?post=3590"}],"version-history":[{"count":0,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/posts\/3590\/revisions"}],"wp:attachment":[{"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/media?parent=3590"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/categories?post=3590"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/unknownerror.org\/index.php\/wp-json\/wp\/v2\/tags?post=3590"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}