<?xml version="1.0" encoding="UTF-8"?><rss version="2.0"
	xmlns:content="http://purl.org/rss/1.0/modules/content/"
	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: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>Comments on: Trackable DTO&#8217;s: Taking N-Tier a Step Further with EF4</title>
	<atom:link href="http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/feed/" rel="self" type="application/rss+xml" />
	<link>http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/</link>
	<description>A glimpse into the lives of Tony &#38; Zuzana Sneed</description>
	<lastBuildDate>Wed, 08 Feb 2012 16:30:26 +0000</lastBuildDate>
	<sy:updatePeriod>hourly</sy:updatePeriod>
	<sy:updateFrequency>1</sy:updateFrequency>
	<generator>http://wordpress.com/</generator>
	<item>
		<title>By: Tony Sneed</title>
		<link>http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-1061</link>
		<dc:creator><![CDATA[Tony Sneed]]></dc:creator>
		<pubDate>Mon, 09 Jan 2012 13:50:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-1061</guid>
		<description><![CDATA[Looks like the zip file got corrupted.  I&#039;ll repair the link and post here to let you know it&#039;s been fixed.  Thanks!

Tony]]></description>
		<content:encoded><![CDATA[<p>Looks like the zip file got corrupted.  I&#8217;ll repair the link and post here to let you know it&#8217;s been fixed.  Thanks!</p>
<p>Tony</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morgan Lord</title>
		<link>http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-1054</link>
		<dc:creator><![CDATA[Morgan Lord]]></dc:creator>
		<pubDate>Tue, 03 Jan 2012 23:23:48 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-1054</guid>
		<description><![CDATA[As an update to my post. I added the following extension method to the ServiceChangeTracker...called from AddAttachEntities and DeleteEntites using the following invocation (I&#039;m still testing it) - 
// Assume entity set name is the same as the nav property name
string navEntitySetName = context.DefaultContainerName + &quot;.&quot; + context.GetNavigationEntitySet(entity, navPropertyName); /*navPropertyName*/

// Get EntitySet for the specified entity&#039;s navigation
private static string GetNavigationEntitySet(this ObjectContext context, object entity, string navPropertyName)
        {
            EntityType entityType = context.MetadataWorkspace
                .GetCSpaceEntityType(entity.GetType());

            EntityContainer entityContainer = context.MetadataWorkspace
                .GetEntityContainer(context.DefaultContainerName, DataSpace.CSpace);

            NavigationProperty navProp = entityType.NavigationProperties.Where(n =&gt; n.Name == navPropertyName).SingleOrDefault();
            string navEndTypeName = navProp.ToEndMember.GetEntityType().Name;
            string navEndRelationKeyName = navProp.RelationshipType.RelationshipEndMembers[navEndTypeName].DeclaringType.FullName;            

            EntitySetBase entitySetNavRelation = entityContainer
                .BaseEntitySets.Where(bes =&gt; bes.ElementType.FullName == navEndRelationKeyName).SingleOrDefault();

            RelationshipSet relationshipSet = null;
            AssociationSet associationSet = null;
            if (entityContainer.TryGetRelationshipSetByName(entitySetNavRelation.Name, true, out relationshipSet))
            {
                associationSet = relationshipSet as AssociationSet;
            }
            if (associationSet == null)
            {
                throw new ArgumentException(String.Format(&quot;Unable to find a CSpace AssociationSet for type {0} given navigation name {1}&quot;, entityType.Name, navPropertyName));
            }

            AssociationSetEnd associationSetEnd = associationSet.AssociationSetEnds.Where(ase =&gt; ase.Name == navEndTypeName).SingleOrDefault();
            string navEndEntitySetName = associationSetEnd.EntitySet.Name;

            return navEndEntitySetName;           
        }]]></description>
		<content:encoded><![CDATA[<p>As an update to my post. I added the following extension method to the ServiceChangeTracker&#8230;called from AddAttachEntities and DeleteEntites using the following invocation (I&#8217;m still testing it) &#8211;<br />
// Assume entity set name is the same as the nav property name<br />
string navEntitySetName = context.DefaultContainerName + &#8220;.&#8221; + context.GetNavigationEntitySet(entity, navPropertyName); /*navPropertyName*/</p>
<p>// Get EntitySet for the specified entity&#8217;s navigation<br />
private static string GetNavigationEntitySet(this ObjectContext context, object entity, string navPropertyName)<br />
        {<br />
            EntityType entityType = context.MetadataWorkspace<br />
                .GetCSpaceEntityType(entity.GetType());</p>
<p>            EntityContainer entityContainer = context.MetadataWorkspace<br />
                .GetEntityContainer(context.DefaultContainerName, DataSpace.CSpace);</p>
<p>            NavigationProperty navProp = entityType.NavigationProperties.Where(n =&gt; n.Name == navPropertyName).SingleOrDefault();<br />
            string navEndTypeName = navProp.ToEndMember.GetEntityType().Name;<br />
            string navEndRelationKeyName = navProp.RelationshipType.RelationshipEndMembers[navEndTypeName].DeclaringType.FullName;            </p>
<p>            EntitySetBase entitySetNavRelation = entityContainer<br />
                .BaseEntitySets.Where(bes =&gt; bes.ElementType.FullName == navEndRelationKeyName).SingleOrDefault();</p>
<p>            RelationshipSet relationshipSet = null;<br />
            AssociationSet associationSet = null;<br />
            if (entityContainer.TryGetRelationshipSetByName(entitySetNavRelation.Name, true, out relationshipSet))<br />
            {<br />
                associationSet = relationshipSet as AssociationSet;<br />
            }<br />
            if (associationSet == null)<br />
            {<br />
                throw new ArgumentException(String.Format(&#8220;Unable to find a CSpace AssociationSet for type {0} given navigation name {1}&#8221;, entityType.Name, navPropertyName));<br />
            }</p>
<p>            AssociationSetEnd associationSetEnd = associationSet.AssociationSetEnds.Where(ase =&gt; ase.Name == navEndTypeName).SingleOrDefault();<br />
            string navEndEntitySetName = associationSetEnd.EntitySet.Name;</p>
<p>            return navEndEntitySetName;<br />
        }</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tim</title>
		<link>http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-1053</link>
		<dc:creator><![CDATA[Tim]]></dc:creator>
		<pubDate>Tue, 03 Jan 2012 21:56:44 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-1053</guid>
		<description><![CDATA[First I&#039;d like to say that I really enjoyed your point of view in the webinar on this topic. I have been struggling with this the past few weeks. And I&#039;ve finally gotten a few good pointers to continue my journey with the Entity Framework in N-Tier architectures. 

However, I&#039;m unable to download the source code associated with this blogpost. Could you please check if the downloads are still working? I&#039;d like to take a look at the T4 templates, but can&#039;t find them anywhere.

Thanks for sharing with the community!]]></description>
		<content:encoded><![CDATA[<p>First I&#8217;d like to say that I really enjoyed your point of view in the webinar on this topic. I have been struggling with this the past few weeks. And I&#8217;ve finally gotten a few good pointers to continue my journey with the Entity Framework in N-Tier architectures. </p>
<p>However, I&#8217;m unable to download the source code associated with this blogpost. Could you please check if the downloads are still working? I&#8217;d like to take a look at the T4 templates, but can&#8217;t find them anywhere.</p>
<p>Thanks for sharing with the community!</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Morgan Lord</title>
		<link>http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-1044</link>
		<dc:creator><![CDATA[Morgan Lord]]></dc:creator>
		<pubDate>Fri, 23 Dec 2011 20:45:11 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-1044</guid>
		<description><![CDATA[Hi Tony,

I appreciate the great post.

I was hoping you could provide a little background on the decision to use the navigation property name as the entityset when attaching to the context. I&#039;m new to EF and I&#039;m looking at how I could modify the solution to support entity per type where the navigation property name is not used as the entityset but is instead deterministically found. I thought that getting the dependent (FK) of the navigation would allow me to then determine its base type and it turn get the base type&#039;s entityset (and do so for each child in the graph).

I updated the service template to code generate the base type inheritance with the trackable interface.

For example, I have a People entityset of type Person. When modifing an object of base type Person I would like to attach it to the correct entityset (People).

e.g. context.AttachTo(&quot;People&quot;, objectWithPersonBaseType);

Any pointers or gotchas would be appreciated.
Thanks. 
Morgan]]></description>
		<content:encoded><![CDATA[<p>Hi Tony,</p>
<p>I appreciate the great post.</p>
<p>I was hoping you could provide a little background on the decision to use the navigation property name as the entityset when attaching to the context. I&#8217;m new to EF and I&#8217;m looking at how I could modify the solution to support entity per type where the navigation property name is not used as the entityset but is instead deterministically found. I thought that getting the dependent (FK) of the navigation would allow me to then determine its base type and it turn get the base type&#8217;s entityset (and do so for each child in the graph).</p>
<p>I updated the service template to code generate the base type inheritance with the trackable interface.</p>
<p>For example, I have a People entityset of type Person. When modifing an object of base type Person I would like to attach it to the correct entityset (People).</p>
<p>e.g. context.AttachTo(&#8220;People&#8221;, objectWithPersonBaseType);</p>
<p>Any pointers or gotchas would be appreciated.<br />
Thanks.<br />
Morgan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony Sneed</title>
		<link>http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-1037</link>
		<dc:creator><![CDATA[Tony Sneed]]></dc:creator>
		<pubDate>Fri, 09 Dec 2011 14:28:55 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-1037</guid>
		<description><![CDATA[My implementation of trackable DTO&#039;s has a client T4 template that generates classes based on the service metadata.  That&#039;s a conscious design decision.  This relieves the client and service from needed to reference a common assembly, which decouples them and is a more &#039;service-oriented&#039; approach.  EF Self-Tracking Entities take the approach you&#039;re asking about, which is to generate the client entity classes from the data model.

Cheers,
Tony]]></description>
		<content:encoded><![CDATA[<p>My implementation of trackable DTO&#8217;s has a client T4 template that generates classes based on the service metadata.  That&#8217;s a conscious design decision.  This relieves the client and service from needed to reference a common assembly, which decouples them and is a more &#8216;service-oriented&#8217; approach.  EF Self-Tracking Entities take the approach you&#8217;re asking about, which is to generate the client entity classes from the data model.</p>
<p>Cheers,<br />
Tony</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Vishwa</title>
		<link>http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-1033</link>
		<dc:creator><![CDATA[Vishwa]]></dc:creator>
		<pubDate>Wed, 07 Dec 2011 07:07:40 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-1033</guid>
		<description><![CDATA[Thanks for the great post Tony. Just curious, how to modify the client side T4 template which would create client objects from Model/database instead of service.]]></description>
		<content:encoded><![CDATA[<p>Thanks for the great post Tony. Just curious, how to modify the client side T4 template which would create client objects from Model/database instead of service.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony Sneed</title>
		<link>http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-697</link>
		<dc:creator><![CDATA[Tony Sneed]]></dc:creator>
		<pubDate>Thu, 31 Mar 2011 12:10:58 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-697</guid>
		<description><![CDATA[Nope, those classes are there to support Code-First with EF, which doesn&#039;t have anything to do with change-tracking.]]></description>
		<content:encoded><![CDATA[<p>Nope, those classes are there to support Code-First with EF, which doesn&#8217;t have anything to do with change-tracking.</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Raj</title>
		<link>http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-684</link>
		<dc:creator><![CDATA[Raj]]></dc:creator>
		<pubDate>Mon, 28 Mar 2011 17:38:47 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-684</guid>
		<description><![CDATA[Would there be any changes in your code if I&#039;m using EF 4.1 with introduction of DbContext and DbSet]]></description>
		<content:encoded><![CDATA[<p>Would there be any changes in your code if I&#8217;m using EF 4.1 with introduction of DbContext and DbSet</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Alan Josephson</title>
		<link>http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-291</link>
		<dc:creator><![CDATA[Alan Josephson]]></dc:creator>
		<pubDate>Tue, 19 Oct 2010 20:16:22 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-291</guid>
		<description><![CDATA[Tony,

Are all of the open items in the ReadMe.txt file addressed in the latest version?

Client T4 TODO:
- Include assoc fixup code
- Perform cascading deletes
- Handle change to Tracking property
- Set foreign keys on added child entities
- Implement GetChanges method

Also, I am getting errors when I try to execute your templates in my projects:

&quot;Could not find file &#039;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MyModel.edmx&#039;&quot;

It seems to be looking for the model in the wrong directory.  Any ideas?  Happy to take this discussion off-line if you like.

- Alan]]></description>
		<content:encoded><![CDATA[<p>Tony,</p>
<p>Are all of the open items in the ReadMe.txt file addressed in the latest version?</p>
<p>Client T4 TODO:<br />
- Include assoc fixup code<br />
- Perform cascading deletes<br />
- Handle change to Tracking property<br />
- Set foreign keys on added child entities<br />
- Implement GetChanges method</p>
<p>Also, I am getting errors when I try to execute your templates in my projects:</p>
<p>&#8220;Could not find file &#8216;c:\Program Files (x86)\Microsoft Visual Studio 10.0\Common7\IDE\MyModel.edmx&#8217;&#8221;</p>
<p>It seems to be looking for the model in the wrong directory.  Any ideas?  Happy to take this discussion off-line if you like.</p>
<p>- Alan</p>
]]></content:encoded>
	</item>
	<item>
		<title>By: Tony Sneed</title>
		<link>http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-289</link>
		<dc:creator><![CDATA[Tony Sneed]]></dc:creator>
		<pubDate>Thu, 14 Oct 2010 01:19:39 +0000</pubDate>
		<guid isPermaLink="false">http://blog.tonysneed.com/2010/02/19/trackable-dtos-taking-n-tier-a-step-further-with-ef4/#comment-289</guid>
		<description><![CDATA[Yes, this is the latest version. Enjoy!]]></description>
		<content:encoded><![CDATA[<p>Yes, this is the latest version. Enjoy!</p>
]]></content:encoded>
	</item>
</channel>
</rss>

