<?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/"
	xmlns:georss="http://www.georss.org/georss" xmlns:geo="http://www.w3.org/2003/01/geo/wgs84_pos#" xmlns:media="http://search.yahoo.com/mrss/"
	>

<channel>
	<title>Mehroz's Experiments</title>
	<atom:link href="http://smehrozalam.wordpress.com/feed/" rel="self" type="application/rss+xml" />
	<link>http://smehrozalam.wordpress.com</link>
	<description>My computational experiments, mostly related to .Net and SQL server, to be posted here</description>
	<lastBuildDate>Tue, 31 Jan 2012 11:18:05 +0000</lastBuildDate>
	<language>en</language>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
<cloud domain='smehrozalam.wordpress.com' port='80' path='/?rsscloud=notify' registerProcedure='' protocol='http-post' />
<image>
		<url>http://s2.wp.com/i/buttonw-com.png</url>
		<title>Mehroz's Experiments</title>
		<link>http://smehrozalam.wordpress.com</link>
	</image>
	<atom:link rel="search" type="application/opensearchdescription+xml" href="http://smehrozalam.wordpress.com/osd.xml" title="Mehroz&#039;s Experiments" />
	<atom:link rel='hub' href='http://smehrozalam.wordpress.com/?pushpress=hub'/>
		<item>
		<title>Goodbye GoodCore, Welcome DevEnhanced</title>
		<link>http://smehrozalam.wordpress.com/2011/06/30/goodbye-goodcore-welcome-devenhanced/</link>
		<comments>http://smehrozalam.wordpress.com/2011/06/30/goodbye-goodcore-welcome-devenhanced/#comments</comments>
		<pubDate>Thu, 30 Jun 2011 18:00:42 +0000</pubDate>
		<dc:creator>Syed Mehroz Alam</dc:creator>
				<category><![CDATA[Achievements]]></category>
		<category><![CDATA[devenhanced]]></category>
		<category><![CDATA[goodcore]]></category>
		<category><![CDATA[personal]]></category>

		<guid isPermaLink="false">http://smehrozalam.wordpress.com/?p=1131</guid>
		<description><![CDATA[I have been working at GoodCore Software for more than 4 years. I have had a great time here and learned so much from my colleagues. But I have decided to try something new – Starting July 2011, I have co-founded a new company, DevEnhanced, with my friend Fawad Moon. Of course, there is never [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1131&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>I have been working at <a href="http://www.goodcoresoft.com">GoodCore Software</a> for more than 4 years. I have had a great time here and learned so much from my colleagues. But I have decided to try something new – Starting July 2011, I have co-founded a new company, <a href="http://www.devenhanced.com/">DevEnhanced</a>, with my friend Fawad Moon.</p>
<p>Of course, there is never a good time to leave, but I feel satisfied with my tenure at GoodCore. I recently accomplished an enterprise educational content management system that involved all the latest .NET 4 flavors: WPF, Silverlight and ASP.NET were used for user interface, WCF for communication, Entity Framework for data access and SQL Server for storage. I was involved as the lead architect and gained a lot of experience and knowledge while working on the project. </p>
<p>Apart from handling some .NET projects at GoodCore, I also looked after few business intelligence and data warehousing projects. I utilized SQL reporting services and highly complex TSQL queries for dashboards and analytical reports, SQL Integration services for data extraction, transformation, loading, aggregation, integration and migration, and SQL Analysis services for building multidimensional structures, cubes and analytic solutions. </p>
<p>In this post, I would like to thank all the great folks at GoodCore for their support, cooperation and guidance. I hope the company will continue to have a positive reputation in the software industry.</p>
<p>Now I look forward to a new venture at DevEnhanced that brings forth new challenges and will add more diverse experience to my career. Please do remember me in your prayers and best wishes.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/smehrozalam.wordpress.com/1131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/smehrozalam.wordpress.com/1131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/smehrozalam.wordpress.com/1131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/smehrozalam.wordpress.com/1131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/smehrozalam.wordpress.com/1131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/smehrozalam.wordpress.com/1131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/smehrozalam.wordpress.com/1131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/smehrozalam.wordpress.com/1131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/smehrozalam.wordpress.com/1131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/smehrozalam.wordpress.com/1131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/smehrozalam.wordpress.com/1131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/smehrozalam.wordpress.com/1131/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/smehrozalam.wordpress.com/1131/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/smehrozalam.wordpress.com/1131/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1131&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://smehrozalam.wordpress.com/2011/06/30/goodbye-goodcore-welcome-devenhanced/feed/</wfw:commentRss>
		<slash:comments>10</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/12d4d94c607dcfa4dfc7b8ea307b3c64?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">Mehroz</media:title>
		</media:content>
	</item>
		<item>
		<title>WCF RIA Service adding extra Required attribute on generated classes</title>
		<link>http://smehrozalam.wordpress.com/2011/04/27/wcf-ria-service-adding-extra-required-attribute-on-generated-classes/</link>
		<comments>http://smehrozalam.wordpress.com/2011/04/27/wcf-ria-service-adding-extra-required-attribute-on-generated-classes/#comments</comments>
		<pubDate>Wed, 27 Apr 2011 18:00:17 +0000</pubDate>
		<dc:creator>Syed Mehroz Alam</dc:creator>
				<category><![CDATA[RIA Services]]></category>
		<category><![CDATA[attribute]]></category>
		<category><![CDATA[generated code]]></category>
		<category><![CDATA[required]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[stringlength]]></category>
		<category><![CDATA[wcf ria]]></category>

		<guid isPermaLink="false">http://smehrozalam.wordpress.com/?p=1119</guid>
		<description><![CDATA[Few days back, I upgraded a Silverlight 3 RIA application to Silveright 4 bits. Once I fixed all the errors, it appeared that RIA generated entities were &#8220;over-validating&#8221; themselves. I noticed that all the string entities that were marked not-nullable in database were giving validation errors saying "Field XYZ is required". I looked through the [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1119&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Few days back, I upgraded a Silverlight 3 RIA application to Silveright 4 bits. Once I fixed all the errors, it appeared that RIA generated entities were <strong>&#8220;over-validating&#8221;</strong> themselves. I noticed that all the string entities that were marked <strong>not-nullable</strong> in database were giving validation errors saying <code>"Field XYZ is required"</code>. <span id="more-1119"></span>I looked through the attribute metadata classes and those field were not marked <code>Required</code>. However, the generated RIA classes had <code>Required</code> and <code>StringLength</code> attributes automatically applied on such fields. It looks RIA code generation is over-efficient and it automatically adds <code>Required</code> attributes for all non-nullable database fields. This doesn’t seem much problematic since we can easily write an implementation of the partial method <code>OnCreated</code> for our generated entities where we can assign default values to all fields. As a generic approach, we can write a reflective method that assign default values like this:</p>
<p><pre class="brush: csharp;">
public static void SetDefaults(object obj)
{
    DateTime defaultDate = new DateTime(1753, 1, 1);
    PropertyInfo[] infos = obj.GetType().GetProperties();
    foreach (PropertyInfo info in infos)
    {
        if (info.CanWrite)
        {
            //numeric fields (int, double etc) are already defaulted to 0
 
            //string
            if (info.PropertyType == typeof(string)) 
                info.SetValue(obj, string.Empty, null);
            
            //date fields
            else if (info.PropertyType == typeof(DateTime))
                info.SetValue(obj, defaultDate, null);

            //timestamps
            else if (info.PropertyType == typeof(byte[]))
                info.SetValue(obj, new byte[1], null);
        }
    }
}
</pre></p>
<p>The above method needs to be called from the partial implementation of <code>OnCreated</code> for our generated data classes. However, things will still not work normally as there&#8217;s still a small point left: The <code>Required</code> attribute on string fields does not allow empty string. To tackle this, we need to decorate all our string fields in the metadata class (located in server project) with <code>[Required(AllowEmptyString = true)]</code>. That&#8217;s all. </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/smehrozalam.wordpress.com/1119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/smehrozalam.wordpress.com/1119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/smehrozalam.wordpress.com/1119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/smehrozalam.wordpress.com/1119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/smehrozalam.wordpress.com/1119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/smehrozalam.wordpress.com/1119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/smehrozalam.wordpress.com/1119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/smehrozalam.wordpress.com/1119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/smehrozalam.wordpress.com/1119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/smehrozalam.wordpress.com/1119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/smehrozalam.wordpress.com/1119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/smehrozalam.wordpress.com/1119/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/smehrozalam.wordpress.com/1119/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/smehrozalam.wordpress.com/1119/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1119&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://smehrozalam.wordpress.com/2011/04/27/wcf-ria-service-adding-extra-required-attribute-on-generated-classes/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/12d4d94c607dcfa4dfc7b8ea307b3c64?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">Mehroz</media:title>
		</media:content>
	</item>
		<item>
		<title>Silverlight (and WPF): How to make items stretch horizontally in a ListBox</title>
		<link>http://smehrozalam.wordpress.com/2011/01/31/silverlight-and-wpf-how-to-make-items-stretch-horizontally-in-a-listbox/</link>
		<comments>http://smehrozalam.wordpress.com/2011/01/31/silverlight-and-wpf-how-to-make-items-stretch-horizontally-in-a-listbox/#comments</comments>
		<pubDate>Mon, 31 Jan 2011 12:55:50 +0000</pubDate>
		<dc:creator>Syed Mehroz Alam</dc:creator>
				<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[WPF]]></category>
		<category><![CDATA[datatemplate]]></category>
		<category><![CDATA[HorizontalContentAlignment]]></category>
		<category><![CDATA[ItemTemplate]]></category>
		<category><![CDATA[listbox]]></category>
		<category><![CDATA[textwrapping]]></category>

		<guid isPermaLink="false">http://smehrozalam.wordpress.com/?p=1102</guid>
		<description><![CDATA[Sometimes we need to use controls like TextBox, TextBlock etc (that set their width automatically depending on content) in a ListBox&#8217;s ItemTemplate. If we need to draw Borders or assign Background colors to each such controls then we may end up having non-equal rows. Here&#8217;s a sample markup: Here&#8217;s the output for the above XAML: [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1102&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Sometimes we need to use controls like TextBox, TextBlock etc (that set their width automatically depending on content) in a ListBox&#8217;s ItemTemplate. If we need to draw Borders or assign Background colors to each such controls then we may end up having non-equal rows. <span id="more-1102"></span>Here&#8217;s a sample markup:</p>
<p><pre class="brush: xml;">
&lt;ListBox ItemsSource=&quot;{Binding MyList}&quot; &gt;
    &lt;ListBox.ItemTemplate&gt;
        &lt;DataTemplate&gt;
            &lt;TextBox Text=&quot;{Binding}&quot; Background=&quot;LightYellow&quot;  /&gt;
        &lt;/DataTemplate&gt;
    &lt;/ListBox.ItemTemplate&gt;
&lt;/ListBox&gt;
</pre></p>
<p>Here&#8217;s the output for the above XAML:</p>
<p><a href="http://smehrozalam.files.wordpress.com/2011/01/listbox-1.jpg"><img src="http://smehrozalam.files.wordpress.com/2011/01/listbox-1.jpg?w=780" alt="" title="listbox with items unstretched"   class="alignnone size-full wp-image-1104" /></a></p>
<p>A quick thought would be to assign <code>HorizontalContentAlignment</code> property to <code>Stretch</code> for the TextBox but this wont work. We need to specify this property for the <code>ListBoxItem</code> that encapsulates our <code>DataTemplate</code>. Here&#8217;s a quick syntax for doing this using a style:</p>
<p><pre class="brush: xml; highlight: [3,4,5,8];">
&lt;Grid&gt;
    &lt;Grid.Resources&gt;
        &lt;Style x:Key=&quot;ListBoxItemStyle&quot; TargetType=&quot;ListBoxItem&quot;&gt;
            &lt;Setter Property=&quot;HorizontalContentAlignment&quot; Value=&quot;Stretch&quot;/&gt;
        &lt;/Style&gt;
    &lt;/Grid.Resources&gt;
    &lt;ListBox Margin=&quot;100&quot; ItemsSource=&quot;{Binding MyList}&quot; 
                ItemContainerStyle=&quot;{StaticResource ListBoxItemStyle}&quot;
                &gt;
        &lt;ListBox.ItemTemplate&gt;
            &lt;DataTemplate&gt;
                &lt;TextBox Text=&quot;{Binding}&quot; Background=&quot;LightYellow&quot;  /&gt;
            &lt;/DataTemplate&gt;
        &lt;/ListBox.ItemTemplate&gt;
    &lt;/ListBox&gt;
&lt;/Grid&gt;
</pre></p>
<p>And here&#8217;s the output:<br />
<a href="http://smehrozalam.files.wordpress.com/2011/01/listbox-2.jpg"><img src="http://smehrozalam.files.wordpress.com/2011/01/listbox-2.jpg?w=780" alt="" title="listbox-2"   class="alignnone size-full wp-image-1105" /></a></p>
<p>This should be fine in most case but sometimes we also need to wrap the text as highlighted using red arrows in the above image. Now setting <code>TextWrapping</code> property will have no effect as the TextBox thinks it can take all the horizontal space. This can be solved by disabling the horizontal scroll bar for the ListBox:<br />
<pre class="brush: xml; highlight: [9,15];">
&lt;Grid&gt;
    &lt;Grid.Resources&gt;
        &lt;Style x:Key=&quot;ListBoxItemStyle&quot; TargetType=&quot;ListBoxItem&quot;&gt;
            &lt;Setter Property=&quot;HorizontalContentAlignment&quot; Value=&quot;Stretch&quot;/&gt;
        &lt;/Style&gt;
    &lt;/Grid.Resources&gt;
    &lt;ListBox Margin=&quot;100&quot; ItemsSource=&quot;{Binding MyList}&quot; 
                ItemContainerStyle=&quot;{StaticResource ListBoxItemStyle}&quot;
                ScrollViewer.HorizontalScrollBarVisibility=&quot;Disabled&quot;
                &gt;
        &lt;ListBox.ItemTemplate&gt;
            &lt;DataTemplate&gt;
                &lt;TextBox Text=&quot;{Binding}&quot; 
                    Background=&quot;LightYellow&quot;
                    TextWrapping=&quot;Wrap&quot; /&gt;
            &lt;/DataTemplate&gt;
        &lt;/ListBox.ItemTemplate&gt;
    &lt;/ListBox&gt;
&lt;/Grid&gt;
</pre></p>
<p>Here&#8217;s the final output:</p>
<p><a href="http://smehrozalam.files.wordpress.com/2011/01/listbox-3.jpg"><img src="http://smehrozalam.files.wordpress.com/2011/01/listbox-3.jpg?w=780" alt="" title="listbox-3"   class="alignnone size-full wp-image-1106" /></a></p>
<p>Nice learning for me!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/smehrozalam.wordpress.com/1102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/smehrozalam.wordpress.com/1102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/smehrozalam.wordpress.com/1102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/smehrozalam.wordpress.com/1102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/smehrozalam.wordpress.com/1102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/smehrozalam.wordpress.com/1102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/smehrozalam.wordpress.com/1102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/smehrozalam.wordpress.com/1102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/smehrozalam.wordpress.com/1102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/smehrozalam.wordpress.com/1102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/smehrozalam.wordpress.com/1102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/smehrozalam.wordpress.com/1102/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/smehrozalam.wordpress.com/1102/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/smehrozalam.wordpress.com/1102/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1102&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://smehrozalam.wordpress.com/2011/01/31/silverlight-and-wpf-how-to-make-items-stretch-horizontally-in-a-listbox/feed/</wfw:commentRss>
		<slash:comments>5</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/12d4d94c607dcfa4dfc7b8ea307b3c64?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">Mehroz</media:title>
		</media:content>

		<media:content url="http://smehrozalam.files.wordpress.com/2011/01/listbox-1.jpg" medium="image">
			<media:title type="html">listbox with items unstretched</media:title>
		</media:content>

		<media:content url="http://smehrozalam.files.wordpress.com/2011/01/listbox-2.jpg" medium="image">
			<media:title type="html">listbox-2</media:title>
		</media:content>

		<media:content url="http://smehrozalam.files.wordpress.com/2011/01/listbox-3.jpg" medium="image">
			<media:title type="html">listbox-3</media:title>
		</media:content>
	</item>
		<item>
		<title>C#: Fun with Indexers</title>
		<link>http://smehrozalam.wordpress.com/2010/12/29/c-fun-with-indexers/</link>
		<comments>http://smehrozalam.wordpress.com/2010/12/29/c-fun-with-indexers/#comments</comments>
		<pubDate>Wed, 29 Dec 2010 18:00:48 +0000</pubDate>
		<dc:creator>Syed Mehroz Alam</dc:creator>
				<category><![CDATA[Dotnet]]></category>
		<category><![CDATA[c#]]></category>
		<category><![CDATA[indexer]]></category>
		<category><![CDATA[item]]></category>

		<guid isPermaLink="false">http://smehrozalam.wordpress.com/?p=1086</guid>
		<description><![CDATA[This post refers to an interesting situation when you create a class in C# with an indexer and a property named &#8220;Item&#8221;. Let&#8217;s see why this is not possible simultaneously. Few days back, I got an interesting error. I had a class with a property named Item and an indexer like this: Nothing special? But [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1086&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>This post refers to an interesting situation when you create a class in C# with an indexer and a property named &#8220;Item&#8221;. Let&#8217;s see why this is not possible simultaneously.<br />
<span id="more-1086"></span><br />
Few days back, I got an interesting error. I had a class with a property named <code>Item</code> and an <code>indexer</code> like this:</p>
<p><pre class="brush: csharp;">
public class SomeClass
{
    List&lt;int&gt; someList;

    //property
    public string Item { get; set; }
        
    //indexer
    public int this[int index]
    {
        get { return someList[index]; }
        set { someList[index] = value; }
    }
}
</pre></p>
<p>Nothing special? But when I tried to compile, it complained saying:<br />
<pre class="brush: plain;">
The type 'MyNamespace.DataClasses.SomeClass' already contains a definition for 'Item'.
</pre></p>
<p>Strange!! and the location of the error as pointed by Visual Studio was my indexer:</p>
<p><a href="http://smehrozalam.files.wordpress.com/2010/12/vs-error.jpg"><img src="http://smehrozalam.files.wordpress.com/2010/12/vs-error.jpg?w=780" alt="" title="c# error: The type already contains a definition for Item"   class="alignnone size-full wp-image-1087" /></a></p>
<p>Well, the reason is that internally, C# converts the indexer to a property name &#8216;Item&#8217; to be able to support other languages that don&#8217;t directly support indexers. Since I had already defined a property name <code>Item</code>, so a conflict was created. Luckily, this can be solved by forcing the compiler to use a custom name other than &#8216;Item&#8217; by using the <a href="http://msdn.microsoft.com/en-us/library/system.runtime.compilerservices.indexernameattribute.aspx">IndexerNameAttribute</a>. So, here’s a quick fix for such situation:</p>
<p> <pre class="brush: csharp;">
[IndexerName(&quot;Indexer&quot;)]
public int this[int index]
{
    get { return someList[index]; }
    set { someList[index] = value; }
}
</pre></p>
<p>Enjoy!!!</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/smehrozalam.wordpress.com/1086/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/smehrozalam.wordpress.com/1086/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/smehrozalam.wordpress.com/1086/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/smehrozalam.wordpress.com/1086/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/smehrozalam.wordpress.com/1086/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/smehrozalam.wordpress.com/1086/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/smehrozalam.wordpress.com/1086/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/smehrozalam.wordpress.com/1086/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/smehrozalam.wordpress.com/1086/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/smehrozalam.wordpress.com/1086/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/smehrozalam.wordpress.com/1086/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/smehrozalam.wordpress.com/1086/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/smehrozalam.wordpress.com/1086/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/smehrozalam.wordpress.com/1086/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1086&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://smehrozalam.wordpress.com/2010/12/29/c-fun-with-indexers/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/12d4d94c607dcfa4dfc7b8ea307b3c64?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">Mehroz</media:title>
		</media:content>

		<media:content url="http://smehrozalam.files.wordpress.com/2010/12/vs-error.jpg" medium="image">
			<media:title type="html">c# error: The type already contains a definition for Item</media:title>
		</media:content>
	</item>
		<item>
		<title>RIA Services: Sending complex types to the client</title>
		<link>http://smehrozalam.wordpress.com/2010/11/24/ria-services-sending-complex-types-to-the-client/</link>
		<comments>http://smehrozalam.wordpress.com/2010/11/24/ria-services-sending-complex-types-to-the-client/#comments</comments>
		<pubDate>Wed, 24 Nov 2010 11:59:12 +0000</pubDate>
		<dc:creator>Syed Mehroz Alam</dc:creator>
				<category><![CDATA[RIA Services]]></category>
		<category><![CDATA[Silverlight]]></category>
		<category><![CDATA[Complex Type]]></category>
		<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[ria service]]></category>

		<guid isPermaLink="false">http://smehrozalam.wordpress.com/?p=1043</guid>
		<description><![CDATA[Entity Framework 4 allows us to create complex types. Typically, such types are used to get the result of a stored procedure. However, when we try to send such a complex type using a WCF RIA Domain Service, the following error is encountered. What to do? Adding attributes to EF designer generated classes is a [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1043&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Entity Framework 4 allows us to create complex types. Typically, such types are used to get the result of a stored procedure. However, when we try to send such a complex type using a WCF RIA Domain Service, the following error is encountered.</p>
<p><pre class="brush: plain;">
The entity ' StoredProcedure_Result' in DomainService 'MyDomainService' does not have a key defined. Entities exposed by DomainService operations must have at least one public property marked with the KeyAttribute.
</pre></p>
<p>What to do? <span id="more-1043"></span>Adding attributes to EF designer generated classes is a bad idea; Also, we cannot use partial classes to add attributes to an already defined property. However, luckily, WCF RIA Services uses metadata classes in conjunction with the entity model classes and hence we can always create a meta data class for our complex type and decorate one of the fields with a <code>[Key]</code> attribute. E.g., If our stored procedure is returning <code>StoredProcedure_Result</code>, then we may just need to add the following in our <code>DomainService.metadata.cs</code> file:</p>
<p><pre class="brush: csharp;">
[MetadataTypeAttribute(typeof(StoredProcedure_Result.StoredProcedure_Result_Metadata))]
public partial class StoredProcedure_Result
{
    internal sealed class StoredProcedure_Result_Metadata
    {
        // Metadata classes are not meant to be instantiated, so mark constructor as private
        private StoredProcedure_Result_Metadata()
        { }
 
        [Key]
        public string SomeUniqueColumn { get; set; }
    }
}
</pre></p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/smehrozalam.wordpress.com/1043/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/smehrozalam.wordpress.com/1043/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/smehrozalam.wordpress.com/1043/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/smehrozalam.wordpress.com/1043/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/smehrozalam.wordpress.com/1043/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/smehrozalam.wordpress.com/1043/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/smehrozalam.wordpress.com/1043/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/smehrozalam.wordpress.com/1043/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/smehrozalam.wordpress.com/1043/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/smehrozalam.wordpress.com/1043/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/smehrozalam.wordpress.com/1043/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/smehrozalam.wordpress.com/1043/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/smehrozalam.wordpress.com/1043/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/smehrozalam.wordpress.com/1043/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1043&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://smehrozalam.wordpress.com/2010/11/24/ria-services-sending-complex-types-to-the-client/feed/</wfw:commentRss>
		<slash:comments>6</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/12d4d94c607dcfa4dfc7b8ea307b3c64?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">Mehroz</media:title>
		</media:content>
	</item>
		<item>
		<title>DataContractSerializer: Working with class inheritence and circular references</title>
		<link>http://smehrozalam.wordpress.com/2010/10/26/datacontractserializer-working-with-class-inheritence-and-circular-references/</link>
		<comments>http://smehrozalam.wordpress.com/2010/10/26/datacontractserializer-working-with-class-inheritence-and-circular-references/#comments</comments>
		<pubDate>Tue, 26 Oct 2010 18:33:59 +0000</pubDate>
		<dc:creator>Syed Mehroz Alam</dc:creator>
				<category><![CDATA[wcf]]></category>
		<category><![CDATA[datacontractserializer]]></category>
		<category><![CDATA[hierarchy]]></category>
		<category><![CDATA[inheritence]]></category>
		<category><![CDATA[reference]]></category>
		<category><![CDATA[relationship]]></category>

		<guid isPermaLink="false">http://smehrozalam.wordpress.com/?p=1065</guid>
		<description><![CDATA[DataContractSerializer is the default serializer used by WCF Services. Typically, we transmit data objects generated via Entity Framework or LINQ To SQL and do not get any serialization issues as the generated classes are ready to handle various serialization scenarios. Some days back, I needed to transmit my own business objects on the wire; encountered [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1065&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>DataContractSerializer is the default serializer used by WCF Services. Typically, we transmit data objects generated via Entity Framework or LINQ To SQL and do not get any serialization issues as the generated classes are ready to handle various serialization scenarios. Some days back, I needed to transmit my own business objects on the wire; encountered a few issues and learned how to handle them. This post will highlight two such issues that may happen when we transmit our own classes via WCF service.</p>
<ol>
<li>Dealing with inheritance hierarchies</li>
<li>Dealing with circular references</li>
</ol>
<p><span id="more-1065"></span></p>
<p><strong>1. Dealing with inheritance hierarchies</strong><br />
Suppose we have a <code>Fruit</code> class with derived classes <code>Orange</code> and <code>Apple</code>. Now, we need to return a list of fruits from a WCF service method like this:</p>
<p><pre class="brush: csharp;">
public List&lt;Fruit&gt; GetSomeFruits()
{
  List&lt;Fruit&gt; list = new List&lt;Fruit&gt;;
  list.Add( new Orange() };
  list.Add( new Apple() };
  list.Add( new Mango() };
  return list;
}
</pre></p>
<p>If we try to call the above method from a client, it will throw a communication exception. Using the test method described in <a href="http://smehrozalam.wordpress.com/2010/09/14/wcf-service-getting-to-the-cause-of-error/">this</a> post, we can see that the DataContractSerializer was unable to serialize the result throwing a <code>System.Runtime.Serialization.SerializationException</code>:</p>
<p><pre class="brush: plain;">
Type 'WebApplication1.CustomBO.Orange' with data contract name 'Orange:http://schemas.datacontract.org/2004/07/WebApplication1.CustomBO' is not expected. Consider using a DataContractResolver or add any types not known statically to the list of known types - for example, by using the KnownTypeAttribute attribute or by adding them to the list of known types passed to DataContractSerializer.
</pre></p>
<p>So the serializer does not know how to serialize a derived object (<code>Orange</code>) as a base object (<code>Fruit</code>). The exception message is quite detailed and presents us a few ways to tackle such situation. Here&#8217;s a quick list:</p>
<p>1. Add <a href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.knowntypeattribute.aspx">KnownTypeAttribute</a> to the Fruit class<br />
2. Add <a href="http://msdn.microsoft.com/en-us/library/system.servicemodel.serviceknowntypeattribute.aspx">ServiceKnownTypeAttribute</a> to the WCF method<br />
3. Add KnownType entries to web.config<br />
4. Create a <a href="http://msdn.microsoft.com/en-us/library/system.runtime.serialization.datacontractresolver.aspx">DataContractResolver</a> and associate it using a <a href="http://msdn.microsoft.com/en-us/library/aa395224.aspx">custom service host</a>.</p>
<p>These methods are very well described in <a href="http://blogs.msdn.com/b/youssefm/archive/2009/04/21/understanding-known-types.aspx">this</a>, and <a href="http://blogs.msdn.com/b/youssefm/archive/2009/06/05/introducing-a-new-datacontractserializer-feature-the-datacontractresolver.aspx">this</a> post by Youssef, as well as <a href="http://blogs.msdn.com/b/sowmy/archive/2006/06/06/all-about-knowntypes.aspx">this</a> post by Sowmy. Checkout the links for some detailed analysis.</p>
<p><strong>2. Dealing with circular references</strong><br />
Assume we have a <code>FruitBasket</code> class that contains a collection of <code>Fruit</code> objects. If such relation is bi-directional (like the navigational properties Entity Framework creates), we will have a List property in our <code>FruitBasket</code> class and a FruitBasket property in our <code>Fruit</code> class:</p>
<p><pre class="brush: csharp;">
public class FruitBasket
{
  List&lt;Fruit&gt; fruitCollection;
  public List&lt;Fruit&gt; FruitCollection
  {
    get { return this.fruitCollection; }
    set { this.fruitCollection = value; }
  }
}

public class Fruit
{
  FruitBasket basketContainer;
  public FruitBasket BasketContainer
  {
    get { return this.basketContainer; }
    set { this.basketContainer = value; }
  }
}
</pre></p>
<p>When we try to send such bi-directionally related objects with multiple Fruit objects containing a reference to the <strong>same</strong> <code>FruitBasket</code> object, we will get a <code>SerializationException</code>:</p>
<p><pre class="brush: plain;">
Object graph for type 'WebApplication1.CustomBO.Orange' contains cycles and cannot be serialized if reference tracking is disabled.
</pre></p>
<p>To solve this, we need to explicitly tell the DataContractSerializer that a single <code>FruitBasket</code> can be referenced by multiple <code>Fruit</code> objects. This can be done by decorating FruitBasket object with <code>[DataContract(IsReference=true)]</code>. For some more details, check out <a href="http://msdn.microsoft.com/en-us/library/cc656708.aspx">this</a> MSDN document and <a href="http://zamd.net/2008/05/20/datacontract-serializer-and-isreference-property/">this</a> blog post by Zulfiqar. If our data classes share some base class (which is always a good idea), then we may simply decorate the top-level base class with such attribute and enjoy the beauty of referential serialization.  </p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/smehrozalam.wordpress.com/1065/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/smehrozalam.wordpress.com/1065/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/smehrozalam.wordpress.com/1065/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/smehrozalam.wordpress.com/1065/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/smehrozalam.wordpress.com/1065/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/smehrozalam.wordpress.com/1065/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/smehrozalam.wordpress.com/1065/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/smehrozalam.wordpress.com/1065/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/smehrozalam.wordpress.com/1065/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/smehrozalam.wordpress.com/1065/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/smehrozalam.wordpress.com/1065/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/smehrozalam.wordpress.com/1065/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/smehrozalam.wordpress.com/1065/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/smehrozalam.wordpress.com/1065/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1065&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://smehrozalam.wordpress.com/2010/10/26/datacontractserializer-working-with-class-inheritence-and-circular-references/feed/</wfw:commentRss>
		<slash:comments>3</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/12d4d94c607dcfa4dfc7b8ea307b3c64?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">Mehroz</media:title>
		</media:content>
	</item>
		<item>
		<title>WCF Service: Getting to the cause of error</title>
		<link>http://smehrozalam.wordpress.com/2010/09/14/wcf-service-getting-to-the-cause-of-error/</link>
		<comments>http://smehrozalam.wordpress.com/2010/09/14/wcf-service-getting-to-the-cause-of-error/#comments</comments>
		<pubDate>Tue, 14 Sep 2010 18:15:40 +0000</pubDate>
		<dc:creator>Syed Mehroz Alam</dc:creator>
				<category><![CDATA[wcf]]></category>
		<category><![CDATA[debugging]]></category>
		<category><![CDATA[serializer]]></category>
		<category><![CDATA[tracing]]></category>

		<guid isPermaLink="false">http://smehrozalam.wordpress.com/?p=1055</guid>
		<description><![CDATA[If you are using WCF service as your mode of communication between client-server applications (and why shouldn&#8217;t you, this has been a great source of communication available since .NET 3.5), then there are chances that something wrong happened and you get a generic Communication Exception at your client. This post will highlight how to find [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1055&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>If you are using WCF service as your mode of communication between client-server applications (and why shouldn&#8217;t you, this has been a great source of communication available since .NET 3.5), then there are chances that something wrong happened and you get a generic <code>Communication Exception</code> at your client. This post will highlight how to find the cause of such error.<br />
<span id="more-1055"></span><br />
The exception raised sometimes in our WPF/Web/WinForms client is:</p>
<p><pre class="brush: plain;">
System.ServiceModel.CommunicationException: The underlying connection was closed: The connection was closed unexpectedly.
</pre></p>
<p>Silverlight guys should be able to recall the famous <code>NotFound</code> exception that was thrown every time anything was wrong. Well, the above communication exception is typically raised when something was wrong at server and it was forced to terminate the service request. The best way to debug such exceptions is to enable WCF Tracing. This is dead simple and requires the following addition to <code>web.config</code> under <code>configuation</code> section:</p>
<p><pre class="brush: xml;">
&lt;system.diagnostics&gt;
   &lt;sources&gt;
         &lt;source name=&quot;System.ServiceModel&quot;
                 switchValue=&quot;Information, ActivityTracing&quot;
                 propagateActivity=&quot;true&quot;&gt;
         &lt;listeners&gt;
            &lt;add name=&quot;traceListener&quot;
                type=&quot;System.Diagnostics.XmlWriterTraceListener&quot;
                initializeData=&quot;wcf_service_traces.svclog&quot; /&gt;
         &lt;/listeners&gt;
      &lt;/source&gt;
   &lt;/sources&gt;
&lt;/system.diagnostics&gt;
</pre></p>
<p>Now we will get a file named: <code>wcf_service_traces.svclog</code> that can be opened via <code>SvcTraceViewer.exe</code> (included with Visual Studio installation). Typically we don&#8217;t need to worry about locating the file as <code>.svclog</code> extension will automatically be associated with that utility. In the utility, look out for error rows highlighted in <span style="color:#ff0000;">red</span>:</p>
<p><a href="http://smehrozalam.files.wordpress.com/2010/08/wcf-trace.jpg"><img class="alignnone size-medium wp-image-1056" title="wcf-trace" src="http://smehrozalam.files.wordpress.com/2010/08/wcf-trace.jpg?w=300&#038;h=236" alt="" width="300" height="236" /></a></p>
<p>For my case, most of the errors were related to <code>DataContractSerializer</code> that was unable to serialize my business entities. So I wrote a quick method to test if an object can be serialized or not. Here&#8217;s the method that was called from each of my unit tests.</p>
<p><pre class="brush: csharp;">
public static void TestSerialization&lt;T&gt;(T objectToSerialize)
{
    DataContractSerializer serializer = new DataContractSerializer(typeof(T));
    using (MemoryStream stream = new MemoryStream())
    {
        //will throw an exception if cant serialize
        serializer.WriteObject(stream, objectToSerialize);
    }
}
</pre></p>
<p>The above method will throw an exception if the entries cannot be serialized and we can look into the exception details to find the actual error. I hope you will find this method and post useful.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/smehrozalam.wordpress.com/1055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/smehrozalam.wordpress.com/1055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/smehrozalam.wordpress.com/1055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/smehrozalam.wordpress.com/1055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/smehrozalam.wordpress.com/1055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/smehrozalam.wordpress.com/1055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/smehrozalam.wordpress.com/1055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/smehrozalam.wordpress.com/1055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/smehrozalam.wordpress.com/1055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/smehrozalam.wordpress.com/1055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/smehrozalam.wordpress.com/1055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/smehrozalam.wordpress.com/1055/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/smehrozalam.wordpress.com/1055/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/smehrozalam.wordpress.com/1055/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1055&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://smehrozalam.wordpress.com/2010/09/14/wcf-service-getting-to-the-cause-of-error/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/12d4d94c607dcfa4dfc7b8ea307b3c64?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">Mehroz</media:title>
		</media:content>

		<media:content url="http://smehrozalam.files.wordpress.com/2010/08/wcf-trace.jpg?w=300" medium="image">
			<media:title type="html">wcf-trace</media:title>
		</media:content>
	</item>
		<item>
		<title>ReportViewer control: Look out for appropriate version when using in Server mode (Remote Processing)</title>
		<link>http://smehrozalam.wordpress.com/2010/08/11/reportviewer-control-look-out-for-appropriate-version-when-using-in-server-mode-remote-processing/</link>
		<comments>http://smehrozalam.wordpress.com/2010/08/11/reportviewer-control-look-out-for-appropriate-version-when-using-in-server-mode-remote-processing/#comments</comments>
		<pubDate>Wed, 11 Aug 2010 18:00:21 +0000</pubDate>
		<dc:creator>Syed Mehroz Alam</dc:creator>
				<category><![CDATA[SSRS]]></category>
		<category><![CDATA[remote processing]]></category>
		<category><![CDATA[report viewer]]></category>
		<category><![CDATA[reports]]></category>

		<guid isPermaLink="false">http://smehrozalam.wordpress.com/?p=1045</guid>
		<description><![CDATA[The report viewer control (available for Windows Forms as well as ASP.NET applications) is used to display reports in our applications. However, it was an interesting observation for me that the ReportViewer control can connect to specific SQL server versions when used in Server Mode(or Remote Mode). The related MSDN docs for report viewer control [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1045&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The report viewer control (available for Windows Forms as well as ASP.NET applications) is used to display reports in our applications. However, it was an interesting observation for me that the ReportViewer control can connect to specific SQL server versions when used in <code>Server Mode</code>(or <code>Remote Mode</code>). <span id="more-1045"></span>The related MSDN docs for report viewer control that verify this behavior can be viewed at <a href="http://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.reportviewer%28v=VS.90%29.aspx">here</a>(version 9.0.0.0, with VS2008, for SQL server 2005+) and <a href="http://msdn.microsoft.com/en-us/library/microsoft.reporting.winforms.reportviewer%28v=VS.100%29.aspx">here</a>(version 10.0.0.0 with VS2010, for SQL server version 2008+). My dev machine has Visual Studio 2010 equipped with SQL Server 2008 R2 and the default report viewer control came out to be version <code>10.0.0.0</code>. When I tried to connect to an existing SQL 2005 report server on my network, it errored out saying:</p>
<p><pre class="brush: plain;">
Remote report processing requires Microsoft SQL Server 2008 Reporting Services or later.
</pre></p>
<p>Strange!! Typically software are backward compatible and new versions support all previous versions but Report Viewer wont. So be careful when choosing your version of Report Viewer. Finally, if you need directions on how to use Report Viewer version 9 with VS2010, here&#8217;s an stack overflow question that may be helpful: <a href="http://stackoverflow.com/questions/3013135/using-reportviewer-9-control-in-vs-2010">http://stackoverflow.com/questions/3013135/using-reportviewer-9-control-in-vs-2010</a>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/smehrozalam.wordpress.com/1045/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/smehrozalam.wordpress.com/1045/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/smehrozalam.wordpress.com/1045/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/smehrozalam.wordpress.com/1045/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/smehrozalam.wordpress.com/1045/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/smehrozalam.wordpress.com/1045/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/smehrozalam.wordpress.com/1045/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/smehrozalam.wordpress.com/1045/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/smehrozalam.wordpress.com/1045/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/smehrozalam.wordpress.com/1045/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/smehrozalam.wordpress.com/1045/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/smehrozalam.wordpress.com/1045/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/smehrozalam.wordpress.com/1045/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/smehrozalam.wordpress.com/1045/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1045&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://smehrozalam.wordpress.com/2010/08/11/reportviewer-control-look-out-for-appropriate-version-when-using-in-server-mode-remote-processing/feed/</wfw:commentRss>
		<slash:comments>1</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/12d4d94c607dcfa4dfc7b8ea307b3c64?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">Mehroz</media:title>
		</media:content>
	</item>
		<item>
		<title>TSQL: Some interesting usages of Coalesce</title>
		<link>http://smehrozalam.wordpress.com/2010/07/29/tsql-some-interesting-usages-of-coalesce/</link>
		<comments>http://smehrozalam.wordpress.com/2010/07/29/tsql-some-interesting-usages-of-coalesce/#comments</comments>
		<pubDate>Wed, 28 Jul 2010 19:20:02 +0000</pubDate>
		<dc:creator>Syed Mehroz Alam</dc:creator>
				<category><![CDATA[T-SQL]]></category>
		<category><![CDATA[coalesce]]></category>
		<category><![CDATA[overriding attributes]]></category>
		<category><![CDATA[tsql]]></category>

		<guid isPermaLink="false">http://smehrozalam.wordpress.com/?p=1028</guid>
		<description><![CDATA[The coalesce function is a really powerful function that can help us in various scenarios. It is described in this MSDN document so I am not going to discuss its working in this post. Instead, I will only present a few interesting usages. Calculating overrideable attributes Combining results from Full Outer Join String concatenation Calculating [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1028&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>The <code>coalesce</code> function is a really powerful function that can help us in various scenarios. It is described in <a href="http://msdn.microsoft.com/en-us/library/ms190349.aspx">this</a> MSDN document so I am not going to discuss its working in this post. Instead, I will only present a few interesting usages.</p>
<ul>
<li>Calculating overrideable attributes</li>
<li>Combining results from Full Outer Join</li>
<li>String concatenation</li>
</ul>
<p><span id="more-1028"></span><br />
<strong>Calculating overrideable attributes</strong><br />
Perhaps the best usage of <code>coalesce</code> function is when we need to pick up some value that can be declared at various levels, and each level can have different priorities. E.g. in one of our scenarios, the rate of a <code>resource</code> can be assigned on the <code>task</code> he/she worked, or on the <code>project</code> the <code>task</code> belongs to, or on the <code>department</code> the <code>project</code> belongs to, or on the <code>resource</code> itself. Here&#8217;s a quick query for such situation:</p>
<p><pre class="brush: sql;">
;With TimesheetWithAllRates as
(
  Select
    ResourceID
    ,HoursWorked
    ,RateFromTask = ( Select Top(1) Rate from TaskRate tr where tr.TaskID = ts.TaskID and tr.ResourceID = ts.ResourceID )
    ,RateFromProject = ( Select Top(1) Rate from ProjectRate pr where pr.ProjectID = ts.ProjectID and pr.ResourceID = ts.ResourceID )
    ,RateFromDept = ( Select Top(1) Rate from DepartmentRate dr where dr.DeptID = ts.DeptID and dr.ResourceID = ts.ResourceID )
    ,RateFromResource = ( Select Top(1) Rate from Resource r where r.ResourceID = ts.ResourceID )
    ...
  From Timesheet ts
)
,TimesheetWithApplicableRate as
(
  Select ResourceID
    ,HoursWorked
    ,Rate = Coalesce(RateFromTask, RateFromProject, RateFromDept, RateFromResource) --starting from left, pickup the first non-null value
    ...
  From TimesheetWithAllRates
)
</pre></p>
<p>Notice that we build all the possible rate combinations in the first CTE and then picked the appropriate one according to desired priority.</p>
<p><strong>Combining results from Full Outer Join</strong><br />
Another interesting scenario for the usage of coalesce is when we need to combine values from two result sets. Suppose we have two tables/CTEs: <code>ProjectAmountsUsingMethod1</code> and <code>ProjectAmountsUsingMethod2</code> having similar columns and we want to see the row-by-row comparison of both the tables per <code>Project</code>. Here&#8217;s a result set assumption:</p>
<p><pre class="brush: sql;">
ProjectAmountsUsingMethod1  as
(
   Select ProjectID, Sum(Amount), ...
   From ... (method1)
)
,ProjectAmountsUsingMethod2 as
(
  Select ProjectID, Sum(Amount), ...
  From ... (method2)
)
</pre></p>
<p>Assume that both methods do not yield same result and we need to compare them. Also, there can exists some Project rows using method1 that are missing when we use method2 and vice verca. So we may need to join both the result set using a full outer join. Here&#8217;s how the <code>coalesce</code> function can build a better output set for comparison (although for this very example, we can also use <code>IsNull</code> since there are only two parameters but this concept can be extended further as well):</p>
<p><pre class="brush: sql;">
Select coalesce(m1.ProjectID, m2.ProjectID), m1.Amount as M1Amount, m2.Amount as M2Amount
From ProjectAmountsUsingMethod1 m1
Full Outer Join ProjectAmountsUsingMethod2 m2 on m1.ProjectID = m2.ProjectID
</pre></p>
<p><strong>String concatenation</strong><br />
This is a fairly common scenario described by various people. If we need to build a comma separated list of  values from a certain column into a variable, then one method is to use <code>coalesce</code>(or <code>IsNull</code>) as:</p>
<p><pre class="brush: sql;">
Declare @myVariable varchar(max) 

Select @myVariable = coalesce(@myVariable + ',', '') + MyColumn
From MyTable
</pre></p>
<p>That&#8217;s all. I hope this post helped you in determining how and when to use the <code>coalesce</code> function. Please share your thoughts by leaving a comment in case you have experienced any other interesting usage of <code>coalesce</code>.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/smehrozalam.wordpress.com/1028/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/smehrozalam.wordpress.com/1028/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/smehrozalam.wordpress.com/1028/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/smehrozalam.wordpress.com/1028/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/smehrozalam.wordpress.com/1028/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/smehrozalam.wordpress.com/1028/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/smehrozalam.wordpress.com/1028/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/smehrozalam.wordpress.com/1028/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/smehrozalam.wordpress.com/1028/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/smehrozalam.wordpress.com/1028/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/smehrozalam.wordpress.com/1028/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/smehrozalam.wordpress.com/1028/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/smehrozalam.wordpress.com/1028/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/smehrozalam.wordpress.com/1028/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=1028&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://smehrozalam.wordpress.com/2010/07/29/tsql-some-interesting-usages-of-coalesce/feed/</wfw:commentRss>
		<slash:comments>2</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/12d4d94c607dcfa4dfc7b8ea307b3c64?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">Mehroz</media:title>
		</media:content>
	</item>
		<item>
		<title>Entity Framework: Queries involving many to many relationship tables</title>
		<link>http://smehrozalam.wordpress.com/2010/06/29/entity-framework-queries-involving-many-to-many-relationship-tables/</link>
		<comments>http://smehrozalam.wordpress.com/2010/06/29/entity-framework-queries-involving-many-to-many-relationship-tables/#comments</comments>
		<pubDate>Tue, 29 Jun 2010 15:03:16 +0000</pubDate>
		<dc:creator>Syed Mehroz Alam</dc:creator>
				<category><![CDATA[Entity Framework]]></category>
		<category><![CDATA[Linq]]></category>
		<category><![CDATA[ef]]></category>
		<category><![CDATA[entity framework 4]]></category>
		<category><![CDATA[linq to sql]]></category>
		<category><![CDATA[query]]></category>

		<guid isPermaLink="false">http://smehrozalam.wordpress.com/?p=988</guid>
		<description><![CDATA[Entity framework handles tables participating in Many to Many relationship in a nice manner. If the junction table (sometimes called bridge table, association table, link table, etc) only consists of the foreign keys and no other columns, then that table is abstracted by EF and the two sides get a navigational property exposing a collection [...]<img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=988&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></description>
			<content:encoded><![CDATA[<p>Entity framework handles tables participating in Many to Many relationship in a nice manner. If the junction table (sometimes called bridge table, association table, link table, etc) only consists of the foreign keys and no other columns, then that table is abstracted by EF and the two sides get a navigational property exposing a collection of the other side. If the junction table contains other fields as well (e.g. the table has its own primary key column), then that junction table is included in the model with many-to-one relationships with both the participating tables. This post will present some common LINQ queries involving the many to many relationship tables in both scenarios: when the junction table is abstracted by EF, and when it is exposed.<span id="more-988"></span></p>
<p>Consider the following scenario having a many to many relationship between Student and Course:</p>
<p><a href="http://smehrozalam.files.wordpress.com/2010/06/erd-many-to-many-1.jpg"><img class="alignnone size-full wp-image-992" title="erd-many-to-many-1" src="http://smehrozalam.files.wordpress.com/2010/06/erd-many-to-many-1.jpg?w=780" alt=""   /></a></p>
<p>The generated Entity Model will look something like:</p>
<p><a href="http://smehrozalam.files.wordpress.com/2010/06/entity-model-many-to-many-1.jpg"><img class="alignnone size-full wp-image-989" title="entity-model-many-to-many-1" src="http://smehrozalam.files.wordpress.com/2010/06/entity-model-many-to-many-1.jpg?w=780" alt=""   /></a></p>
<p>However, if the junction table contains any other field other than the two foreign keys, then EF will create a separate entity for it. E.g. lets assume that the StudentCourseEnrollment table has its own ID and some fields like EnrolledFrom and EnrolledTo, like:</p>
<p><a href="http://smehrozalam.files.wordpress.com/2010/06/erd-many-to-many-2.jpg"><img class="alignnone size-full wp-image-991" title="erd-many-to-many-2" src="http://smehrozalam.files.wordpress.com/2010/06/erd-many-to-many-2.jpg?w=780" alt=""   /></a></p>
<p>The generated Entity Model for the above tables will look like:</p>
<p><a href="http://smehrozalam.files.wordpress.com/2010/06/entity-model-many-to-many-2.jpg"><img class="alignnone size-full wp-image-990" title="entity-model-many-to-many-2" src="http://smehrozalam.files.wordpress.com/2010/06/entity-model-many-to-many-2.jpg?w=780" alt=""   /></a></p>
<p>Now, we will see how to write some typical LINQ queries involving the two tables participating in many to many relationship for both cases (with and without the junction table exposed in EF model):</p>
<p><strong>Get students enrolled in a particular course<br />
</strong></p>
<ul>
<li>For case 1, when there is no junction table, and we have the required CourseID to look for, we may write:</li>
</ul>
<p><pre class="brush: csharp;">
dc.Students.Where(s =&gt; s.Courses.Any(c =&gt; c.CourseID == courseID))

//or without the Any method
from s in dc.Students
from c in s.Courses
where c.CourseID == courseID
select s;
</pre></p>
<ul>
<li>For case 2, when the junction table is included in the entity model, we may need to write:</li>
</ul>
<p><pre class="brush: csharp;">
dc.Students.Where(s =&gt; s.StudentCourseEnrollments.Any(e =&gt; e.Course.CourseID == courseID)

//or without the any method
from s in dc.Students
from e in s.StudentCourseEnrollments
where e.Course.CourseID == courseID
select s;
</pre></p>
<p>If the foreign keys are also included in the model (applicable only for  EF4), we can also directly refer to the <code>CourseID</code> property in the <code>StudentCourseEnrollment</code> table, like:</p>
<p><pre class="brush: csharp;">
dc.Students.Where(s =&gt; s.StudentCourseEnrollments.Any(e =&gt; e.CourseID == courseID)

//or without the any method
from s in dc.Students
from e in s.StudentCourseEnrollments
where e.CourseID == courseID
select s;
</pre></p>
<p>In the above situations, the <code>Any()</code> method is translated to <code>where exists()</code> expression while the other <code>SelectMany</code> methods are translated to <code>join</code> expression.</p>
<p>However, an interesting twist for such queries is to start our query with the junction table and use navigational properties for filtering and selecting. This leaves us with a more compact query:</p>
<p><pre class="brush: csharp;">
dc.StudentCourseEnrollments.Where(e =&gt; e.Course.CourseID == courseID).Select(e=&gt;e.Student);

//the verbose query 
from e in s.StudentCourseEnrollments
where e.Course.CourseID == courseID
select e.Student;
</pre></p>
<p><strong>Get students enrolled in any course from a list of courses</strong></p>
<p>Notice that such query will use the <code>Contains</code> methodology that is only available with Entity Framework 4. For similar queries with EF1 (EF3.5) we can use the <code>BuildContainsExpression</code>() extension method described <a href="http://social.msdn.microsoft.com/Forums/en-US/adodotnetentityframework/thread/095745fe-dcf0-4142-b684-b7e4a1ab59f0">here</a>.</p>
<ul>
<li>For case 1, when the bridge table is abstracted by EF, this can be written as:</li>
</ul>
<p><pre class="brush: csharp;">
int[,] courseIDs = new int[,] { 1,2,3 };
var students =
 from s in dc.Students
 from c in s.Courses
 where courseIDs.Contains(c.CourseID)
 select s;

//similarly, such query can be written with the any method
var students =
 from s in dc.Students
 where (
   from c in s.Courses
   where courseIDs.Contains(c.CourseID)
   select c
   ).Any()
 select s;
</pre></p>
<ul>
<li>For case 2, when the bridge table is included in the entity model, we  may write:</li>
</ul>
<p><pre class="brush: csharp;">
int[,] courseIDs = new int[,] { 1,2,3 };
var students =
 from s in dc.Students
 from e in s.StudentCourseEnrollments
 where courseIDs.Contains(e.Course.CourseID)
 select s;

//starting with the bridge table
var students =
 from e in dc.StudentCourseEnrollments
 where courseIDs.Contains(e.Course.CourseID)
 select e.Student;

//with the any method
var students =
 from s in dc.Students
 where (
   from e in s.StudentCourseEnrollments
   where courseIDs.Contains(e.Course.CourseID)
   select e
   ).Any()
 select s;
</pre></p>
<p><strong>Get students enrolled in ALL courses from a list of courses</strong></p>
<ul>
<li>For case 1, when the bridge table is abstracted by EF, we can write the query as:</li>
</ul>
<p><pre class="brush: csharp;">
int[,] courseIDs = new int[,] { 1,2,3 };
var students =
 from s in dc.Students
 where
  (
   from c in s.Courses
   where courseIDs.Contains(c.CourseID)
   select c
  ).Count() == courseIDs.Count
 select s;
</pre></p>
<ul>
<li>For case 2, when the bridge table is included in the entity model, we may query as:</li>
</ul>
<p><pre class="brush: csharp;">
int[,] courseIDs = new int[,] { 1,2,3 };
var students =
 from s in dc.Students
 where
  (
   from e in s.StudentCourseEnrollments
   where courseIDs.Contains(e.Course.CourseID)
   select e
  ).Count() == courseIDs.Count
 select s;
</pre></p>
<p>Thats&#8217;s all. I will include some more queries in case I find interesting. Notice that same queries can be written for LINQ To SQL also. The only difference is that the bridge table is always included in the model, so always we need to refer to case 2 from this discussion.</p>
<br />  <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gocomments/smehrozalam.wordpress.com/988/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/comments/smehrozalam.wordpress.com/988/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godelicious/smehrozalam.wordpress.com/988/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/delicious/smehrozalam.wordpress.com/988/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gofacebook/smehrozalam.wordpress.com/988/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/facebook/smehrozalam.wordpress.com/988/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gotwitter/smehrozalam.wordpress.com/988/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/twitter/smehrozalam.wordpress.com/988/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/gostumble/smehrozalam.wordpress.com/988/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/stumble/smehrozalam.wordpress.com/988/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/godigg/smehrozalam.wordpress.com/988/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/digg/smehrozalam.wordpress.com/988/" /></a> <a rel="nofollow" href="http://feeds.wordpress.com/1.0/goreddit/smehrozalam.wordpress.com/988/"><img alt="" border="0" src="http://feeds.wordpress.com/1.0/reddit/smehrozalam.wordpress.com/988/" /></a> <img alt="" border="0" src="http://stats.wordpress.com/b.gif?host=smehrozalam.wordpress.com&amp;blog=4540612&amp;post=988&amp;subd=smehrozalam&amp;ref=&amp;feed=1" width="1" height="1" />]]></content:encoded>
			<wfw:commentRss>http://smehrozalam.wordpress.com/2010/06/29/entity-framework-queries-involving-many-to-many-relationship-tables/feed/</wfw:commentRss>
		<slash:comments>18</slash:comments>
	
		<media:content url="http://1.gravatar.com/avatar/12d4d94c607dcfa4dfc7b8ea307b3c64?s=96&#38;d=http%3A%2F%2Fs0.wp.com%2Fi%2Fmu.gif&#38;r=G" medium="image">
			<media:title type="html">Mehroz</media:title>
		</media:content>

		<media:content url="http://smehrozalam.files.wordpress.com/2010/06/erd-many-to-many-1.jpg" medium="image">
			<media:title type="html">erd-many-to-many-1</media:title>
		</media:content>

		<media:content url="http://smehrozalam.files.wordpress.com/2010/06/entity-model-many-to-many-1.jpg" medium="image">
			<media:title type="html">entity-model-many-to-many-1</media:title>
		</media:content>

		<media:content url="http://smehrozalam.files.wordpress.com/2010/06/erd-many-to-many-2.jpg" medium="image">
			<media:title type="html">erd-many-to-many-2</media:title>
		</media:content>

		<media:content url="http://smehrozalam.files.wordpress.com/2010/06/entity-model-many-to-many-2.jpg" medium="image">
			<media:title type="html">entity-model-many-to-many-2</media:title>
		</media:content>
	</item>
	</channel>
</rss>
