<?xml version="1.0" encoding="UTF-8"?>
<rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	xmlns:wfw="http://wellformedweb.org/CommentAPI/"
	xmlns:dc="http://purl.org/dc/elements/1.1/"
	xmlns:atom="http://www.w3.org/2005/Atom"
	xmlns:sy="http://purl.org/rss/1.0/modules/syndication/"
	xmlns:slash="http://purl.org/rss/1.0/modules/slash/"
	>

<channel>
	<title>Avivo Tech Blog &#187; silverlight 2</title>
	<atom:link href="http://tech.avivo.si/tag/silverlight-2/feed/" rel="self" type="application/rss+xml" />
	<link>http://tech.avivo.si</link>
	<description>Solving problems</description>
	<lastBuildDate>Tue, 24 Jan 2012 14:46:25 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.org/?v=3.1</generator>
		<item>
		<title>ArrayOfXElement not recognized by Silverlight 2.0</title>
		<link>http://tech.avivo.si/2009/03/arrayofxelement-not-recognized-by-silverlight-20/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=arrayofxelement-not-recognized-by-silverlight-20</link>
		<comments>http://tech.avivo.si/2009/03/arrayofxelement-not-recognized-by-silverlight-20/#comments</comments>
		<pubDate>Sat, 21 Mar 2009 19:26:54 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Projects]]></category>
		<category><![CDATA[ArrayOfXElement]]></category>
		<category><![CDATA[bug]]></category>
		<category><![CDATA[development]]></category>
		<category><![CDATA[interactive]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[multimedia]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[silverlight 2]]></category>
		<category><![CDATA[web]]></category>

		<guid isPermaLink="false">http://blog.sweetucan.com/?p=40</guid>
		<description><![CDATA[Last weekend I was working on a Silverlight 2.0 game that loads and saves scores to an external database. Database is accessed via web service which has two methods: GetScore and SaveScore. GetScore returns DataSet and SaveScore returns nothing. Web service proxy is generated as usual &#8211; right click on the project node in VS2008, [...]]]></description>
			<content:encoded><![CDATA[<p>Last weekend I was working on a Silverlight 2.0 game that loads and saves scores to an external database. Database is accessed via web service which has two methods: GetScore and SaveScore. GetScore returns DataSet and SaveScore returns nothing.</p>
<p>Web service proxy is generated as usual &#8211; right click on the project node in VS2008, &#8220;Add Service Reference&#8230;&#8221;, enter url, proxy class is generated and the methods are accessible in the code. But when I tried to build the project an error occured: <em>&#8220;The type or namespace name &#8216;ArrayOfXElement&#8217; does not exist in the namespace&#8221;</em> which means that <strong>ArrayOfXElement is unrecognized</strong> class for the compiler. Searching on the Google reveals that this happens when service method returns DataSet, so <strong>ArrayOfXElement is actually DataSet</strong> and <strong>DataSets are not supported in Silverlight 2.0</strong>.</p>
<p>A quick solution is to replace all &#8216;ArrayOfXElement&#8217; words with &#8216;object&#8217;. Project would build that way but the data would have no meaning.</p>
<p>Another solution is to change the web service return type but this is not always editable by the client side developer.</p>
<p>Finally, workaround idea is to<strong> get DataSet schema and convert it to a class</strong>. How to do this?<br />
1. Create a dummy WPF project.<br />
2. Add web service reference to the WPF project. Return type is DataSet instead of ArrayOfXElement.<br />
3. Write some code to call a web service methods that returns DataSet then extract xsd schema and save it to the disk. Build and run. Sample:<br />
<span>GameServiceClient client = new GameServiceClient();</span><br />
<span>DataSet ds = client.GetScore(1, &#8220;abc&#8221;, &#8220;&#8221;, DateTime.Now);</span><br />
<span>ds.WriteXmlSchema(@&#8221;C:\Temp\Score.xsd&#8221;);</span><br />
4. So you have the xsd file. Now find &#8216;xsd.exe&#8217; which is located in the same directory as &#8216;svcutil.exe&#8217; (e.g. <em>C:\Program Files\Microsoft SDKs\Windows\v6.0A\bin</em>). Run it with arguments:<br />
<span>xsd C:\Temp\Score.xsd /c</span><br />
5. xsd tool generates Score.cs file which contains tables as classes and columns as properties. Include the generated file in the Silverlight project.<br />
6. Replace all &#8216;ArrayOfXElement&#8217; words with &#8216;NewDataSet&#8217; or other class name, depends on the retrieved DataSet name and generated code.</p>
<p>Note that this is just an idea. So far the sample project builds fine but there is a problem with cross-domain security. Another story.</p>
<p>Url to the web service in this example:<br />
<a href="http://www.silverlightclub.com/apps/GameService.asmx">http://www.silverlightclub.com/apps/GameService.asmx</a></p>
<p>References:<br />
<a href="http://silverlight.net/forums/t/60518.aspx">http://silverlight.net/forums/t/60518.aspx</a><br />
<a href="http://blogs.msdn.com/suwatch/archive/2009/01/21/wcf-silverlight-exception-and-serialization.aspx">http://blogs.msdn.com/suwatch/archive/2009/01/21/wcf-silverlight-exception-and-serialization.aspx</a></p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2009/03/arrayofxelement-not-recognized-by-silverlight-20/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
		</item>
		<item>
		<title>Silverlight 2 Plugin not working</title>
		<link>http://tech.avivo.si/2009/02/silverlight-2-plugin-not-working/?utm_source=rss&#038;utm_medium=rss&#038;utm_campaign=silverlight-2-plugin-not-working</link>
		<comments>http://tech.avivo.si/2009/02/silverlight-2-plugin-not-working/#comments</comments>
		<pubDate>Tue, 17 Feb 2009 20:43:26 +0000</pubDate>
		<dc:creator>Avivo</dc:creator>
				<category><![CDATA[Silverlight/WPF]]></category>
		<category><![CDATA[ASP.NET]]></category>
		<category><![CDATA[beta]]></category>
		<category><![CDATA[microsoft]]></category>
		<category><![CDATA[plugin]]></category>
		<category><![CDATA[silverlight]]></category>
		<category><![CDATA[silverlight 2]]></category>
		<category><![CDATA[website]]></category>

		<guid isPermaLink="false">http://blog.sweetucan.com/?p=26</guid>
		<description><![CDATA[Well, maybe you will expirience a problem that Silverlight 2 plugin is not working eventhough you have the latest version 2.0.30825.0 It is showing MIME type: application/x-silverlight-2-b2 This can be if you have old Silverlight 2 Beta version 2.0.10125.0 in bin directory of your website/application. Just ovewrite it with latest version and it will be [...]]]></description>
			<content:encoded><![CDATA[<p>Well, maybe you will expirience a problem that Silverlight 2 plugin is not working eventhough you have the latest version <strong>2.0.30825.0</strong></p>
<p>It is showing MIME type: <strong>application/x-silverlight-2-b2</strong></p>
<p>This can be if you have old Silverlight 2 Beta version <strong>2.0.10125.0</strong> in bin directory of your website/application.</p>
<p>Just ovewrite it with latest version and it will be ok.</p>
<p>Magic!</p>
]]></content:encoded>
			<wfw:commentRss>http://tech.avivo.si/2009/02/silverlight-2-plugin-not-working/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
		</item>
	</channel>
</rss>

