<?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>EntityBag Part VI – RelationshipEntry</title><link>http://blogs.msdn.com/dsimmons/archive/2008/01/24/entitybag-part-vi-relationshipentry.aspx</link><description>Here’s the last piece in the EntityBag saga. RelationshipEntry is a small, DataContract serializeable class which wraps an ObjectStateEntry that represents a pair of related entities. It contains the name of the relationship, the state of the entry, and</description><dc:language>en-US</dc:language><generator>CommunityServer 2.1 SP1 (Build: 61025.2)</generator><item><title>re: EntityBag Part VI – RelationshipEntry</title><link>http://blogs.msdn.com/dsimmons/archive/2008/01/24/entitybag-part-vi-relationshipentry.aspx#7267677</link><pubDate>Sun, 27 Jan 2008 19:33:06 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7267677</guid><dc:creator>ccBoy</dc:creator><description>&lt;p&gt;I tried again yestoday :), I created a new WCF project and Service method is okay,but wcf client looks not good after using 'Add service References...' in VS2008.&lt;/p&gt;
&lt;p&gt;The service side method:&lt;/p&gt;
&lt;p&gt;-------------&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp;public EntityBag&amp;lt;Patient&amp;gt; GetPatientAndCharges(int PatientNum)&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;using (PatientEntities svc = new PatientEntities())&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &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; &amp;nbsp; &amp;nbsp;ObjectQuery&amp;lt;Patient&amp;gt; patients = svc.Patient;&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;var objPatient = (from patient in patients&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;where patient.PatientNumber == PatientNum&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;select patient).First();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;objPatient.PatientCharges.Load();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return svc.CreateEntityBag&amp;lt;Patient&amp;gt;(objPatient); &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; public int UpdatePatientAndChanges(EntityBag&amp;lt;Patient&amp;gt; bagPatient)&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;using (PatientEntities svc = new PatientEntities())&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &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; &amp;nbsp; &amp;nbsp;int ret = -1; &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;bagPatient.UnwrapInto(svc);&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;ret = svc.SaveChanges();&lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;return ret; &lt;/p&gt;
&lt;p&gt; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp; &amp;nbsp;}&lt;/p&gt;
&lt;p&gt;---------&lt;/p&gt;
&lt;p&gt;please find the detail error message as below:&lt;/p&gt;
&lt;p&gt;--------------------------------------&lt;/p&gt;
&lt;p&gt;Error	1	The type 'EntityBagTestClient.ClientSvc.EntityBagOfPatientqHGogXs4' cannot be used as type parameter 'T' in the generic type or method 'EntityBag.Lib.EntityBag&amp;lt;T&amp;gt;'. There is no implicit reference conversion from 'EntityBagTestClient.ClientSvc.EntityBagOfPatientqHGogXs4' to 'System.Data.Objects.DataClasses.IEntityWithKey'.&lt;/p&gt;
&lt;p&gt;--------------------------------------&lt;/p&gt;
&lt;p&gt;1.why does proxy generate a class as &amp;quot;EntityBagOfPatientqHGogXs4&amp;quot; ? &lt;/p&gt;
&lt;p&gt;2. it seems EntityBag&amp;lt;T&amp;gt; can't be serialized ? &amp;nbsp;&lt;/p&gt;
</description></item><item><title>re: EntityBag Part VI – RelationshipEntry</title><link>http://blogs.msdn.com/dsimmons/archive/2008/01/24/entitybag-part-vi-relationshipentry.aspx#7282389</link><pubDate>Mon, 28 Jan 2008 10:59:52 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7282389</guid><dc:creator>dsimmons@microsoft.com</dc:creator><description>&lt;p&gt;I suspect the issue you are having may be either a result of not referencing all of the relevant types on the client so proxy classes are being used instead of the actual types or a matter of not making the serializer aware of the model's types. &amp;nbsp;You can take a look at the new version I put up on code gallery which has a full working service.&lt;/p&gt;
&lt;p&gt;If that doesn't help you debug your system, then let me know, and we'll keep investigating.&lt;/p&gt;
&lt;p&gt;- Danny&lt;/p&gt;
</description></item><item><title>Creating an EntityBag class - article and code from Danny Simmons</title><link>http://blogs.msdn.com/dsimmons/archive/2008/01/24/entitybag-part-vi-relationshipentry.aspx#7295060</link><pubDate>Tue, 29 Jan 2008 04:07:32 GMT</pubDate><guid isPermaLink="false">91d46819-8472-40ad-a661-2c78acb4018c:7295060</guid><dc:creator>Hot Topics</dc:creator><description>&lt;p&gt;Danny Simmons wrote a class that persists the EntityState of objects in an ObjectContext so that they&lt;/p&gt;
</description></item></channel></rss>