<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://blogs.msdn.com/utility/FeedStylesheets/rss.xsl" media="screen"?><rss version="2.0" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:slash="http://purl.org/rss/1.0/modules/slash/" xmlns:wfw="http://wellformedweb.org/CommentAPI/"><channel><title>EF POCO Adapter updated (v1.03)</title><link>http://blogs.msdn.com/jkowalski/archive/2008/09/25/ef-poco-adapter-updated-v1-03.aspx</link><description>I've just posted another round of updates to EF POCO Adapter based on feedback from users. This set of changes is focused on N-tier scenarios and detached entities (it adds missing wrappers for EF APIs and fixes behavior of existing ones). Change log:</description><dc:language>en</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>car insurance &amp;raquo; EF POCO Adapter updated (v1.03)</title><link>http://blogs.msdn.com/jkowalski/archive/2008/09/25/ef-poco-adapter-updated-v1-03.aspx#8965879</link><pubDate>Fri, 26 Sep 2008 06:35:41 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8965879</guid><dc:creator>car insurance &amp;raquo; EF POCO Adapter updated (v1.03)</dc:creator><description>&lt;p&gt;PingBack from &lt;a rel="nofollow" target="_new" href="http://hoursfunnywallpaper.cn/?p=7912"&gt;http://hoursfunnywallpaper.cn/?p=7912&lt;/a&gt;&lt;/p&gt;
</description></item><item><title>re: EF POCO Adapter updated (v1.03)</title><link>http://blogs.msdn.com/jkowalski/archive/2008/09/25/ef-poco-adapter-updated-v1-03.aspx#8993622</link><pubDate>Fri, 10 Oct 2008 05:05:44 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8993622</guid><dc:creator>crazydoctoral</dc:creator><description>&lt;p&gt;Was having trouble with the Generator, until I realised the filenames in the arguments are case sensitive. So classes.Dll failed to work but classes.dll did.&lt;/p&gt;
</description></item><item><title>re: EF POCO Adapter updated (v1.03)</title><link>http://blogs.msdn.com/jkowalski/archive/2008/09/25/ef-poco-adapter-updated-v1-03.aspx#8996594</link><pubDate>Sun, 12 Oct 2008 12:16:29 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:8996594</guid><dc:creator>CraigCav</dc:creator><description>&lt;p&gt;I'm having a little bit of trouble when trying to extend this sample with (what I would consider) a reasonable usage. The problem I encounter occurs after extracting an interface from a class in the model (say, Product : IProduct), and causes the TestMethod GenerateAndUsePocoAdapter() to fail.&lt;/p&gt;
&lt;p&gt;The error message given is: &lt;/p&gt;
&lt;p&gt;Test method NorthwindEF.Tests.AdapterGeneratorTests.GenerateAndUsePocoAdapter threw exception: &amp;nbsp;System.InvalidOperationException: Generated code failed to compile&lt;/p&gt;
&lt;p&gt;Errors (32):&lt;/p&gt;
&lt;p&gt;(2660,13): CS0506 'NorthwindEF.PocoProxies.ProductProxy.ProductID.get': cannot override inherited member 'NorthwindEF.Product.ProductID.get' because it is not marked virtual, abstract, or override&lt;/p&gt;
&lt;p&gt;It also appears that the generated code will fail to compile if one of the model classes implement an interface that exists within another assembly - for example Customer : IAggregateRoot (where IAggregateRoot is an interface that exists in an assembly referenced from the NorthwindEF project).&lt;/p&gt;
</description></item><item><title>Riflessioni su Entity Framework v1 e vNext #2</title><link>http://blogs.msdn.com/jkowalski/archive/2008/09/25/ef-poco-adapter-updated-v1-03.aspx#9007720</link><pubDate>Mon, 20 Oct 2008 19:23:02 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9007720</guid><dc:creator>Evangelism 2.0: riflessioni sul business del software da un punto di vista privilegiato!</dc:creator><description>&lt;p&gt;EntityClient Entity Framework != O/RM Sappiamo tutti che il buon vecchio pattern in un ADO.NET Data Provider&lt;/p&gt;
</description></item><item><title>re: Problems with type exceptions EF POCO Adapter</title><link>http://blogs.msdn.com/jkowalski/archive/2008/09/25/ef-poco-adapter-updated-v1-03.aspx#9132372</link><pubDate>Sat, 22 Nov 2008 01:49:58 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9132372</guid><dc:creator>jlddodger</dc:creator><description>&lt;p&gt;I am having trouble performing a certain type of query. &amp;nbsp;The goal of this query is to create an instance of a custom class that contains a member of the query result type (Customer) for each query result. &amp;nbsp;&lt;/p&gt;
&lt;p&gt;The most obvious query that worked before we began using the EF Poco Adapters is as follows:&lt;/p&gt;
&lt;p&gt;var b = (from r in db.CustomerSet&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where r.Name.Contains(&amp;quot;AUTOMATED&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; orderby r.Name&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; select new Result()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Customer = r&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/p&gt;
&lt;p&gt;However, when enumerating the result of this query, I receive &amp;quot;Argument types do not match&amp;quot;.&lt;/p&gt;
&lt;p&gt;Okay, so what is the actual object represented by &amp;quot;r&amp;quot;?&lt;/p&gt;
&lt;p&gt;{Database.PocoProxies.CustomerProxy}&lt;/p&gt;
&lt;p&gt;Okay, so what if I try to receive that object type directly?&lt;/p&gt;
&lt;p&gt;var d = (from r in db.CustomerSet&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where r.Name.Contains(&amp;quot;AUTOMATED&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; orderby r.Name&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; select new Result()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;CustomerProxy = (CustomerProxy)r&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/p&gt;
&lt;p&gt;This generates &amp;quot;No coercion operator is defined between types 'Database.PocoAdapters.ResellerAdapter' and 'Database.PocoProxies.ResellerProxy'.&amp;quot;&lt;/p&gt;
&lt;p&gt;Hmm... This is having trouble converting from a ResellerAdaptor, so what if I try to receive this type?... no, that can't work...&lt;/p&gt;
&lt;p&gt;var f = (from r in db.ResellerSet&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where r.Name.Contains(&amp;quot;AUTOMATED&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; orderby r.Name&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; select new Result()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ResellerObject = (ResellerAdapter)(IPocoAdapter)r&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; });&lt;/p&gt;
&lt;p&gt;Nope... &amp;nbsp;'Database.PocoAdapters.ResellerAdapter' to type 'EFPocoAdapter.DataClasses.IPocoAdapter'. LINQ to Entities only supports casting Entity Data Model primitive types.&lt;/p&gt;
&lt;p&gt;But that, at least, makes sense...&lt;/p&gt;
&lt;p&gt;Okay so here's what makes me go from hmm... to grr...&lt;/p&gt;
&lt;p&gt;var a = (from r in db.CustomerSet&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; where r.Name.Contains(&amp;quot;AUTOMATED&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; orderby r.Name&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; select r);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Result res = new Result()&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;Customer = a.First(),&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; };&lt;/p&gt;
&lt;p&gt;This works! &amp;nbsp;By performing the construction outside of the query expression, the types magically work... but then we lose nice features like Deferred Loading, etc... (is this correct?)&lt;/p&gt;
&lt;p&gt;But better yet...&lt;/p&gt;
&lt;p&gt;var a2 = (from r in db.CustomerSet&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;where r.Name.Contains(&amp;quot;AUTOMATED&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;orderby r.Name&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;select new&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;{&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; Customer = r&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;});&lt;/p&gt;
&lt;p&gt;The only difference between test (b)--the preferred method--and (a3) is that (a3) constructs an anonymous class instead of a defined one. &amp;nbsp;But, how then can I add functionality to that class if it is anonymous. &amp;nbsp;That is the whole point of constructing an object instead of meddling with the result directly.&lt;/p&gt;
&lt;p&gt;Just to take a stab in the dark. &amp;nbsp;I have witnesses 'Argument types do not match' coming from places where ValidateSameArgTypes fails...&lt;/p&gt;
&lt;p&gt;The stack at the exception is (I hope this formats well):&lt;/p&gt;
&lt;p&gt; 	System.Core.dll!System.Linq.Expressions.Expression.Bind(System.Reflection.MemberInfo member, System.Linq.Expressions.Expression expression) + 0xaa bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.Internal.QueryTranslator.VisitMemberAssignment(System.Linq.Expressions.MemberAssignment assignment = {Reseller = r}) + 0x90 bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.Internal.ExpressionVisitor.VisitBinding(System.Linq.Expressions.MemberBinding binding = {Reseller = r}) + 0x97 bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.Internal.ExpressionVisitor.VisitBindingList(System.Collections.ObjectModel.ReadOnlyCollection&amp;lt;System.Linq.Expressions.MemberBinding&amp;gt; original = Count = 1) + 0x9d bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.Internal.ExpressionVisitor.VisitMemberInit(System.Linq.Expressions.MemberInitExpression init = {new Result() {Reseller = r}}) + 0x91 bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.Internal.ExpressionVisitor.Visit(System.Linq.Expressions.Expression exp = {new Result() {Reseller = r}}) + 0x3fc bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.Internal.QueryTranslator.VisitLambda(System.Linq.Expressions.LambdaExpression lambda = {r =&amp;gt; new Result() {Reseller = r}}) + 0x77 bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.Internal.ExpressionVisitor.Visit(System.Linq.Expressions.Expression exp = {r =&amp;gt; new Result() {Reseller = r}}) + 0x2e0 bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.Internal.ExpressionVisitor.VisitUnary(System.Linq.Expressions.UnaryExpression u = {r =&amp;gt; new Result() {Reseller = r}}) + 0x62 bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.Internal.QueryTranslator.VisitUnary(System.Linq.Expressions.UnaryExpression u = {r =&amp;gt; new Result() {Reseller = r}}) + 0x29c bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.Internal.ExpressionVisitor.Visit(System.Linq.Expressions.Expression exp = {r =&amp;gt; new Result() {Reseller = r}}) + 0xc0 bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.Internal.QueryTranslator.VisitMethodCall.AnonymousMethod(System.Linq.Expressions.Expression c = {r =&amp;gt; new Result() {Reseller = r}}) + 0x42 bytes	&lt;/p&gt;
&lt;p&gt; 	System.Core.dll!System.Linq.Enumerable.WhereSelectEnumerableIterator&amp;lt;System.__Canon,System.__Canon&amp;gt;.MoveNext() + 0xb9 bytes	&lt;/p&gt;
&lt;p&gt; 	System.Core.dll!System.Linq.Buffer&amp;lt;System.Linq.Expressions.Expression&amp;gt;.Buffer(System.Collections.Generic.IEnumerable&amp;lt;System.Linq.Expressions.Expression&amp;gt; source) + 0x1b3 bytes	&lt;/p&gt;
&lt;p&gt; 	System.Core.dll!System.Linq.Enumerable.ToArray&amp;lt;System.Linq.Expressions.Expression&amp;gt;(System.Collections.Generic.IEnumerable&amp;lt;System.Linq.Expressions.Expression&amp;gt; source) + 0x52 bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.Internal.QueryTranslator.VisitMethodCall(System.Linq.Expressions.MethodCallExpression m = {ResellerSet.Where(r =&amp;gt; r.Name.Contains(&amp;quot;AUTOMATED&amp;quot;)).OrderBy(r =&amp;gt; r.Name).Select(r =&amp;gt; new Result() {Reseller = r})}) + 0x135 bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.Internal.ExpressionVisitor.Visit(System.Linq.Expressions.Expression exp = {ResellerSet.Where(r =&amp;gt; r.Name.Contains(&amp;quot;AUTOMATED&amp;quot;)).OrderBy(r =&amp;gt; r.Name).Select(r =&amp;gt; new Result() {Reseller = r})}) + 0x299 bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.Internal.QueryTranslator.Translate&amp;lt;System.Collections.Generic.IEnumerable&amp;lt;Database.ResellerQuery.Result&amp;gt;&amp;gt;(System.Linq.Expressions.Expression pocoExpression = {ResellerSet.Where(r =&amp;gt; r.Name.Contains(&amp;quot;AUTOMATED&amp;quot;)).OrderBy(r =&amp;gt; r.Name).Select(r =&amp;gt; new Result() {Reseller = r})}, out System.Func&amp;lt;EFPocoAdapter.EFPocoContext,object,System.Collections.Generic.IEnumerable&amp;lt;Database.ResellerQuery.Result&amp;gt;&amp;gt; adapterFunction = null) + 0x80 bytes	&lt;/p&gt;
&lt;p&gt; 	EFPocoAdapter.dll!EFPocoAdapter.EFPocoQuery&amp;lt;Database.ResellerQuery.Result&amp;gt;.GetEnumerator() + 0xb0 bytes	&lt;/p&gt;
&lt;p&gt;&amp;gt;	OPS.exe!Database.CustomerByNameQuery.CustomerByNameQuery(Database.ResellerQuery.ParameterSource _parmsGetter = {Method = {Parameters Get_ResellerQueryParameters()}}) Line 513 + 0xa bytes	C#&lt;/p&gt;
&lt;p&gt;-- END STACK --&lt;/p&gt;
&lt;p&gt;Your adapter code has been able to benefit us so far, but I really cannot continue unless I can find a way to query in a way that will let me add functionality to the resulting items. &amp;nbsp;Any advice or insight will be helpful.&lt;/p&gt;
&lt;p&gt;p.s. I have dug into the query translator a bit and I am wondering if perhaps the VisitParameter function which calls TranslateType is partially responsible. &amp;nbsp;I wonder if the assignment would work if the parameter were not translated to an adapter when the parameter is for a member assignment. &amp;nbsp;What do you think?&lt;/p&gt;
&lt;p&gt;Thanks.&lt;/p&gt;
</description></item><item><title>re: EF POCO Adapter updated (v1.03)</title><link>http://blogs.msdn.com/jkowalski/archive/2008/09/25/ef-poco-adapter-updated-v1-03.aspx#9132388</link><pubDate>Sat, 22 Nov 2008 02:16:59 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9132388</guid><dc:creator>jkowalski</dc:creator><description>&lt;p&gt;jlddodger:&lt;/p&gt;
&lt;p&gt;I am aware of this problem. Unfortunately fixing that is much harder than it seems, but there may be worksarounds.&lt;/p&gt;
&lt;p&gt;As part of the query translation EFPocoAdapter must translate queries in terms of POCO objects to use Adapter objects and generate a function that will convert the results back to POCO world. Translating POCO types to Adapter types is easy (there is 1-1 mapping between them and Adapter has all required properties of a POCO). Translating anonymous types is also doable, because C# compiler conveniently generates them using generic types where all property types are type arguments. Translating non-generic, non-entity types which have references to POCO entities is very hard as it would require a new type to be generated.&lt;/p&gt;
&lt;p&gt;You may be able to work around the problem by switching to LINQ to objects before final projection (by calling AsEnumerable()):&lt;/p&gt;
&lt;p&gt;var b = (from r in db.CustomerSet&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;where r.Name.Contains(&amp;quot;AUTOMATED&amp;quot;)&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;orderby r.Name select r)&lt;/p&gt;
&lt;p&gt;	.AsEnumerable()&lt;/p&gt;
&lt;p&gt;	.Select(c=&amp;gt; new Result() { Customer = c });&lt;/p&gt;
&lt;p&gt;Let me know when it works for you.&lt;/p&gt;
&lt;p&gt;Jarek&lt;/p&gt;
</description></item><item><title>re: EF POCO Adapter updated (v1.03)</title><link>http://blogs.msdn.com/jkowalski/archive/2008/09/25/ef-poco-adapter-updated-v1-03.aspx#9132825</link><pubDate>Sat, 22 Nov 2008 18:29:05 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9132825</guid><dc:creator>jlddodger</dc:creator><description>&lt;p&gt;Alright, that sounds reasonable for an explanation. &amp;nbsp;Just so that I am clear, calling AsEnumerable() will cross the Lazy Barrier and evaluate everything both on-the-client and eagerly.... is this correct?&lt;/p&gt;
&lt;p&gt;Proceeding from the assumption that that is correct, I was wondering if perhaps I could change the basic layout of the receiving class to function with the Member-Initializer-Assignment instead of changing to client-side evaluation. &amp;nbsp;For example, you had said that the reason anonymous types were possible is because the compiler instantiates a generic class where each parameter has a corresponding type to one of the generic class type parameters.&lt;/p&gt;
&lt;p&gt;First off, really awesome insight into C# for me. &amp;nbsp;Also, you said that it is easy to convert to an adapter type since it has all of the necessary parameters and the relationship to POCOs is one-to-one.&lt;/p&gt;
&lt;p&gt;Can I directly take advantage of these facts in any way? &amp;nbsp;Can I query for the adapter type? Or even declare my class as generic (hmm... can class type-parameters be used in member-initialization lists...) and construct it similar to an anonymous class type.&lt;/p&gt;
&lt;p&gt;If I am wrong about the performance change going to client-side evaluation, then just let me know. &amp;nbsp;I would love to find out that the easy answer is also the best.&lt;/p&gt;
</description></item><item><title>re: EF POCO Adapter updated (v1.03)</title><link>http://blogs.msdn.com/jkowalski/archive/2008/09/25/ef-poco-adapter-updated-v1-03.aspx#9137240</link><pubDate>Mon, 24 Nov 2008 17:09:09 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9137240</guid><dc:creator>jlddodger</dc:creator><description>&lt;p&gt;Okay, just ignore the previous post. &amp;nbsp;I have determined through testing that deferred loading is not affected by crossing to client evaluation. &amp;nbsp;Also, because entire POCO objects are being requested (an entire Customer object), it makes no difference in network transfer amount whether the result object is constructed on the server- or client-side. &amp;nbsp;Technically, I believe it may be more efficient to construct the result object on the client-side. &amp;nbsp; Thank you for all your help.&lt;/p&gt;
</description></item><item><title>re: EF POCO Adapter updated (v1.03)</title><link>http://blogs.msdn.com/jkowalski/archive/2008/09/25/ef-poco-adapter-updated-v1-03.aspx#9242698</link><pubDate>Fri, 19 Dec 2008 22:27:31 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9242698</guid><dc:creator>jimitndiaye</dc:creator><description>&lt;p&gt;Hi, I having a bit of problem. When trying to compile the generated PocoAdapters, I keep getting the following error: 	'SomeClrNamespace.PocoAdapters.EntityAdapter' must be a non-abstract type with a public parameterless constructor in order to use it as parameter 'TAdapterType' in the generic type or method 'EFPocoAdapter.DataClasses.PocoAdapterBase&amp;lt;TPocoClass&amp;gt;.DetectChanges&amp;lt;TAdapterType,TValue&amp;gt;(TValue, System.Data.Objects.DataClasses.EntityReference&amp;lt;TAdapterType&amp;gt;, string)'&lt;/p&gt;
&lt;p&gt;EntityAdapter and the Poco entity it targets, Entity are both abstract.&lt;/p&gt;
&lt;p&gt;Does DetectChanges absolutely need the 'new' constraint? Cause if does then the generated adapter cannot handle the case wherein an abstract class is the target of an EntityReference relationship. For instance in your sample NorthWindEF model, if Territory had a NavigationProperty back to the Employee, the generated Adapter wouldn't work.&lt;/p&gt;
&lt;p&gt;Can you recommend a work around?&lt;/p&gt;
&lt;p&gt;Many Thanks,&lt;/p&gt;
&lt;p&gt;Jimit Ndiaye&lt;/p&gt;
</description></item><item><title>re: EF POCO Adapter updated (v1.03)</title><link>http://blogs.msdn.com/jkowalski/archive/2008/09/25/ef-poco-adapter-updated-v1-03.aspx#9249020</link><pubDate>Tue, 23 Dec 2008 05:30:22 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9249020</guid><dc:creator>jimitndiaye</dc:creator><description>&lt;p&gt;Is there any intention to support function imports in the generated Poco container?&lt;/p&gt;
</description></item><item><title>EF POCO Adapter updated (v1.03): GetHashCode</title><link>http://blogs.msdn.com/jkowalski/archive/2008/09/25/ef-poco-adapter-updated-v1-03.aspx#9489817</link><pubDate>Thu, 19 Mar 2009 15:27:08 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:9489817</guid><dc:creator>wuwu1976</dc:creator><description>&lt;p&gt;Hello!&lt;/p&gt;
&lt;p&gt;First of all, thanks for the great job done with the poco adapter... &lt;/p&gt;
&lt;p&gt;I have found a problem for which I really hope you will help me... &lt;/p&gt;
&lt;p&gt;So here it is:&lt;/p&gt;
&lt;p&gt;I have following poco class: Group with long Id (primary key), string Name&lt;/p&gt;
&lt;p&gt;My problem is, that when I get the group from 2 contexts, even though they are the same, the method groups.Contains(group) returns false, but it should return true. &lt;/p&gt;
&lt;p&gt;HashSet&amp;lt;Group&amp;gt; groups = new HashSet&amp;lt;Group&amp;gt;();&lt;/p&gt;
&lt;p&gt;using (MyEntities context1 = new MyEntities ()) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Group group = context1.Groups.First(g =&amp;gt; g.Id == 3);&lt;/p&gt;
&lt;p&gt; &amp;nbsp;groups.Add(group);&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;using (MyEntities context2 = new MyEntities ()) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp;Group group = context2.Groups.First(g =&amp;gt; g.Id == 3);&lt;/p&gt;
&lt;p&gt; &amp;nbsp;if (!groups.Contains(group)) {&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;groups.Add(group);&lt;/p&gt;
&lt;p&gt; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;}&lt;/p&gt;
&lt;p&gt;To make it work, I have override the GetHashCode method on the Group poco class:&lt;/p&gt;
&lt;p&gt;public override int GetHashCode() {&lt;/p&gt;
&lt;p&gt; &amp;nbsp;//Group id is a primary key&lt;/p&gt;
&lt;p&gt; &amp;nbsp;return Id.GetHashCode();&lt;/p&gt;
&lt;p&gt;} &amp;nbsp;&lt;/p&gt;
&lt;p&gt;So the code works now. But I get exceptions from the PocoAdapter when trying to detach the group, or when calling DetectChanges, SaveChanges, etc. The exception is &amp;quot;InvalidOperationException(&amp;quot;Entity is already attached with another active context. Cannot reattach.&amp;quot;)&amp;quot; and comes from your method GetAdapterObject(...). When it calls _adapterObjects.TryGetValue(entity, out value), the value returned is null. &lt;/p&gt;
&lt;p&gt;As far as I can understand, you add the entities to the _adapterObjects dictionary and it adds them before they are filled with values...&lt;/p&gt;
&lt;p&gt;Could you please help me out? &amp;nbsp;&lt;/p&gt;
&lt;p&gt;Thanks a lot in advance.&lt;/p&gt;
&lt;p&gt;Kind regards &lt;/p&gt;
&lt;p&gt;Marc Wuergler&lt;/p&gt;
</description></item></channel></rss>