<?xml version="1.0" encoding="UTF-8" ?>
<?xml-stylesheet type="text/xsl" href="http://community.entityspaces.net/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>LINQ</title><link>http://community.entityspaces.net/forums/48.aspx</link><description>EntitySpaces on LINQ</description><dc:language>en</dc:language><generator>CommunityServer 2008.5 SP1 (Build: 31031.3054)</generator><item><title>Re: ES collection from LINQ to XML</title><link>http://community.entityspaces.net/forums/thread/10064.aspx</link><pubDate>Mon, 30 Jun 2008 08:55:29 GMT</pubDate><guid isPermaLink="false">fc29756b-907a-45c7-bf99-e939cf2d0092:10064</guid><dc:creator>kimobcn</dc:creator><slash:comments>0</slash:comments><comments>http://community.entityspaces.net/forums/thread/10064.aspx</comments><wfw:commentRss>http://community.entityspaces.net/forums/commentrss.aspx?SectionID=48&amp;PostID=10064</wfw:commentRss><description>&lt;P&gt;I think I solved the problem myself. Instead of Addnew I set the FK value and called AttachEntity.&lt;/P&gt;
&lt;DIV class=code&gt;
&lt;H6&gt;Code:&lt;/H6&gt;&lt;PRE class=coloredcode&gt;        &lt;SPAN class=kwd&gt;For Each&lt;/SPAN&gt; Item &lt;SPAN class=kwd&gt;As&lt;/SPAN&gt; Funcionario &lt;SPAN class=kwd&gt;In&lt;/SPAN&gt; ident
            Item.TramitesId = 1
            tramite.FuncionarioCollectionByTramitesId.AttachEntity(Item)
        &lt;SPAN class=kwd&gt;Next&lt;/SPAN&gt;
        tramite.Save()
&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks for your support &lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: ES collection from LINQ to XML</title><link>http://community.entityspaces.net/forums/thread/10031.aspx</link><pubDate>Fri, 27 Jun 2008 15:09:48 GMT</pubDate><guid isPermaLink="false">fc29756b-907a-45c7-bf99-e939cf2d0092:10031</guid><dc:creator>kimobcn</dc:creator><slash:comments>0</slash:comments><comments>http://community.entityspaces.net/forums/thread/10031.aspx</comments><wfw:commentRss>http://community.entityspaces.net/forums/commentrss.aspx?SectionID=48&amp;PostID=10031</wfw:commentRss><description>&lt;P&gt;I could elaborate a little.&lt;/P&gt;
&lt;P&gt;Fragment of the XML:&lt;/P&gt;
&lt;DIV class=code&gt;
&lt;H6&gt;Code:&lt;/H6&gt;&lt;PRE class=coloredcode&gt;					&amp;lt;&lt;SPAN class=tag&gt;Identificacion&lt;/SPAN&gt;&amp;gt;
						&amp;lt;&lt;SPAN class=tag&gt;Tipo_Personalidad&lt;/SPAN&gt;&amp;gt;1&amp;lt;/&lt;SPAN class=tag&gt;Tipo_Personalidad&lt;/SPAN&gt;&amp;gt;
						&amp;lt;&lt;SPAN class=tag&gt;Nombre&lt;/SPAN&gt;&amp;gt;NOMBRE FUNCIONARIO&amp;lt;/&lt;SPAN class=tag&gt;Nombre&lt;/SPAN&gt;&amp;gt;
						&amp;lt;&lt;SPAN class=tag&gt;Apellidos&lt;/SPAN&gt;&amp;gt;APELLIDOS FUNCIONARIO&amp;lt;/&lt;SPAN class=tag&gt;Apellidos&lt;/SPAN&gt;&amp;gt;
						&amp;lt;&lt;SPAN class=tag&gt;Identificador_Administrativo&lt;/SPAN&gt;&amp;gt;
							&amp;lt;&lt;SPAN class=tag&gt;Tipo&lt;/SPAN&gt;&amp;gt;3&amp;lt;/&lt;SPAN class=tag&gt;Tipo&lt;/SPAN&gt;&amp;gt;
							&amp;lt;&lt;SPAN class=tag&gt;Numero_Documento&lt;/SPAN&gt;&amp;gt;99999999L&amp;lt;/&lt;SPAN class=tag&gt;Numero_Documento&lt;/SPAN&gt;&amp;gt;
						&amp;lt;/&lt;SPAN class=tag&gt;Identificador_Administrativo&lt;/SPAN&gt;&amp;gt;
					&amp;lt;/&lt;SPAN class=tag&gt;Identificacion&lt;/SPAN&gt;&amp;gt;
&lt;/PRE&gt;&lt;PRE class=coloredcode&gt;And my code&lt;/PRE&gt;&lt;PRE class=coloredcode&gt;&lt;DIV class=code&gt;&lt;H6&gt;Code:&lt;/H6&gt;&lt;PRE class=coloredcode&gt;        &lt;SPAN class=kwd&gt;Dim&lt;/SPAN&gt; tramite &lt;SPAN class=kwd&gt;As New&lt;/SPAN&gt; Tramites
        tramite.LoadByPrimaryKey(1)
        &lt;SPAN class=kwd&gt;Dim&lt;/SPAN&gt; adminXML &lt;SPAN class=kwd&gt;As&lt;/SPAN&gt; XDocument = XDocument.Load(&lt;SPAN class=st&gt;"C:\test\propiedad.xml"&lt;/SPAN&gt;)

     
        &lt;SPAN class=kwd&gt;Dim&lt;/SPAN&gt; ident = From id &lt;SPAN class=kwd&gt;In&lt;/SPAN&gt; adminXML...&amp;lt;Identificacion&amp;gt; _
                   &lt;SPAN class=kwd&gt;Select New&lt;/SPAN&gt; Funcionario &lt;SPAN class=kwd&gt;With&lt;/SPAN&gt; {.Nombre = id...&amp;lt;Nombre&amp;gt;.Value, _
                    .Apellidos = id...&amp;lt;Apellidos&amp;gt;.Value, _
                    .Nif = id...&amp;lt;Numero_Documento&amp;gt;.Value}


        &lt;SPAN class=kwd&gt;For Each&lt;/SPAN&gt; Item &lt;SPAN class=kwd&gt;As&lt;/SPAN&gt; Funcionario &lt;SPAN class=kwd&gt;In&lt;/SPAN&gt; ident
            &lt;SPAN class=kwd&gt;Dim&lt;/SPAN&gt; funcion &lt;SPAN class=kwd&gt;As&lt;/SPAN&gt; Funcionario = tramite.FuncionarioCollectionByTramitesId.AddNew&lt;/PRE&gt;&lt;PRE class=coloredcode&gt;&lt;EM&gt;            &lt;/EM&gt;&lt;SPAN class=cmt&gt;&lt;EM&gt;'This works, but it's not very elegant
&lt;/EM&gt;&lt;/SPAN&gt;&lt;STRONG&gt;            funcion.Apellidos = Item.Apellidos
            funcion.Nif = Item.Nif
            funcion.Nombre = Item.Nombre&lt;/STRONG&gt;
            &lt;SPAN class=cmt&gt;&lt;EM&gt;'...
            'and so on... More than 100 fields in real&lt;/EM&gt; life
            &lt;/SPAN&gt;&lt;/PRE&gt;&lt;PRE class=coloredcode&gt;&lt;SPAN class=cmt&gt;
            &lt;EM&gt;'This (what I want) does not work
&lt;/EM&gt;&lt;/SPAN&gt;            &lt;STRONG&gt;funcion = Item&lt;/STRONG&gt;&lt;/PRE&gt;&lt;PRE class=coloredcode&gt;&lt;STRONG&gt;&lt;/STRONG&gt;&lt;EM&gt;            'The ES object 'funcion' is filled with the values from
            ' 'Item' but only writes NULLs to the database.&lt;/EM&gt;

        &lt;SPAN class=kwd&gt;Next&lt;/SPAN&gt;
        tramite.Save()
&lt;/PRE&gt;&lt;/DIV&gt;&lt;/PRE&gt;&lt;/DIV&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;If I print the contents of the 'funcion' instance, the object is filled with the correct data in both cases, but if I use "funcion=item" the save just inserts the ID, FK ID and nulls.&lt;/P&gt;
&lt;P&gt;I am lost.....&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>Re: ES collection from LINQ to XML</title><link>http://community.entityspaces.net/forums/thread/10012.aspx</link><pubDate>Thu, 26 Jun 2008 14:53:50 GMT</pubDate><guid isPermaLink="false">fc29756b-907a-45c7-bf99-e939cf2d0092:10012</guid><dc:creator>Mike.Griffin</dc:creator><slash:comments>0</slash:comments><comments>http://community.entityspaces.net/forums/thread/10012.aspx</comments><wfw:commentRss>http://community.entityspaces.net/forums/commentrss.aspx?SectionID=48&amp;PostID=10012</wfw:commentRss><description>&lt;P&gt;I will do an experiment tonight and get back to you, we currently support only LINQ to SQL but my guess is this will plug in nicely, we could include it in a maintenance release if so.&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item><item><title>ES collection from LINQ to XML</title><link>http://community.entityspaces.net/forums/thread/10011.aspx</link><pubDate>Thu, 26 Jun 2008 14:35:26 GMT</pubDate><guid isPermaLink="false">fc29756b-907a-45c7-bf99-e939cf2d0092:10011</guid><dc:creator>kimobcn</dc:creator><slash:comments>0</slash:comments><comments>http://community.entityspaces.net/forums/thread/10011.aspx</comments><wfw:commentRss>http://community.entityspaces.net/forums/commentrss.aspx?SectionID=48&amp;PostID=10011</wfw:commentRss><description>&lt;P&gt;Hi,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;I need to read, parse and write (insert) to a database information contained in XML messages coming from our customers. Is there a way to&amp;nbsp;target an&amp;nbsp;ES collection&amp;nbsp;as the results of a LINQ to XML query? &lt;/P&gt;
&lt;P&gt;The basic idea&amp;nbsp;is:&lt;/P&gt;
&lt;P&gt;Read XML&lt;/P&gt;
&lt;P&gt;Execute a LINQ to&amp;nbsp;XML putting the result in an ES Collection&lt;/P&gt;
&lt;P&gt;Insert&amp;nbsp;the collection to the Database&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Thanks,&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;
&lt;P&gt;Jaume&lt;/P&gt;
&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;div style="clear:both;"&gt;&lt;/div&gt;</description></item></channel></rss>