﻿<?xml version="1.0" encoding="utf-8"?><rss 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:media="http://search.yahoo.com/mrss/" xmlns:feedburner="http://rssnamespace.org/feedburner/ext/1.0" version="2.0"><channel><title>Intersoft Community - Crosslight - Create and add child</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Create-and-add-child/</link><description /><generator>http://www.intersoftsolutions.com</generator><language>en</language><copyright>Copyright 2002 - 2015 Intersoft Solutions Corp. All rights reserved.</copyright><ttl>60</ttl><item><title>Create and add child</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Create-and-add-child/</link><pubDate>Wed, 18 Mar 2015 14:19:53 GMT</pubDate><dc:creator>prog1</dc:creator><description>&lt;p&gt;This is working. But you have two change operations and server calls now.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;1. This woul increase incoming traffic on the server. Bad if you have to pay for.&lt;/p&gt;&lt;p&gt;2. If you have two relations you would have to keep three repositories. More relations -&amp;gt; more repositories to keep. You would need more memory.&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;&lt;p&gt;I would expect a more efficent way to get this done. Especially within an enterprise application. The "normal" entitie framework can handle this with just one call.&lt;/p&gt;</description></item><item><title>Create and add child</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Create-and-add-child/</link><pubDate>Tue, 17 Mar 2015 06:51:41 GMT</pubDate><dc:creator>yudi</dc:creator><description>&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Have you tried the following?&lt;/span&gt;&lt;/p&gt;&lt;pre&gt;this.Item = this.ItemRepository.Create();

// set the ItemId to avoid foreign key constraint violation
Child child = new Child() { ItemId = this.Item.Id };
this.Item.Childs.Add(child);


this.ItemRepository.Insert(this.Item);
this.ChildRepository.Insert(child);

this.ItemRepository.SaveChangesAsync();
this.ChildRepository.SaveChangesAsync();&lt;/pre&gt;
&lt;p&gt;&lt;span style="color: #1f497d;"&gt;Hope this helps.&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Create and add child</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Create-and-add-child/</link><pubDate>Tue, 10 Mar 2015 09:29:27 GMT</pubDate><dc:creator>prog1</dc:creator><description>&lt;p&gt;Yes, I am using the EditableEntityRepository.&lt;/p&gt;&lt;p&gt;I am getting a foreign key contraint violation. Especially if I add two or more childs.&lt;/p&gt;&lt;p&gt;Should I use another repository? Is there a code sample?&lt;/p&gt;&lt;p&gt;&amp;nbsp;&lt;/p&gt;</description></item><item><title>Create and add child</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Create-and-add-child/</link><pubDate>Tue, 27 Jan 2015 17:05:12 GMT</pubDate><dc:creator>technical@intersoftpt.com</dc:creator><description>&lt;p&gt;Hello Fabian,&lt;/p&gt;&lt;p&gt;Could you please inform what type of repository that you use? Is it EditableEntityRepository?&lt;/p&gt;&lt;p&gt;Also, could you please inform the error you received in details?&lt;/p&gt;&lt;p&gt;&lt;span style="font-size: 10pt;"&gt;Thanks!&lt;/span&gt;&lt;/p&gt;</description></item><item><title>Create and add child</title><link>http://www.intersoftsolutions.com/Community/Crosslight/Create-and-add-child/</link><pubDate>Thu, 22 Jan 2015 20:25:32 GMT</pubDate><dc:creator>prog1</dc:creator><description>&lt;p&gt;I am trying to add an item and some childs with one submit, but this does lead to an error.&lt;/p&gt;&lt;p&gt;What ist the regular way to add childs and child of child? An example would be nice.&amp;nbsp;&lt;/p&gt;&lt;p&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;this&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;Item &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;=&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt; &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;this&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;Repository&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;Create();&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;br&gt;&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;            &lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;this&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;Repository&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;Insert(&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;this&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;Item);&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;p&gt;&lt;span color="#dcdcdc" face="Consolas"&gt;this.Item.Childs.Add(new Child());&lt;/span&gt;&lt;/p&gt;&lt;span color="#dcdcdc" face="Consolas"&gt;&lt;p&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;&lt;span color="#569cd6" face="Consolas" size="2"&gt;this&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;Repository&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;&lt;span color="#b4b4b4" face="Consolas" size="2"&gt;.&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;&lt;span color="#dcdcdc" face="Consolas" size="2"&gt;SaveChangesAsync();&lt;/span&gt;&lt;/span&gt;&lt;/span&gt;&lt;/p&gt;&lt;/span&gt;&lt;p&gt;&lt;br&gt;&lt;/p&gt;</description></item></channel></rss>