EDN Admin
Well-known member
Hi,
I am writing a windows service which reads xml from a folder and processed to the tables in the sql database. I am using 3 layer. I have the following XML Structure
<pre class="prettyprint <?xml version="1.0" encoding="utf-8" ?>
<RootData version="1.0
<User>
<UserItem>
<ID></ID>
<Name></Name>
</UserItem>
</User>
<Account>
<AccountItem>
<ID></ID>
<Name></Name>
</AccountItem>
</Account>
</RootData>[/code]
In my database i have separate table for each section in the xml like User, Account etc. I have business entities for this xml. When new xml came i validate the xml against xsd and deserialize in to the object. The user have multiple item and likewise each
section have multiple item or 0. To avoid loop for inserting the multiple item into the table, after deserialize i check the count of each list and serialize the section into xml (if the count > 0). Then the serialized xml passed to the stored procedure
as a parameter.
Is this the correct way of doing this scenario? Suddenly i thought this question because, i deserialize the xml and again serialize each item and sent to the stored procedure. So this is time consuming process (in performance way) in my mind. Can anyone
guid me on this?
OR any best method like split each section and directly pass as parameter to the stored procedure so that we can avoid deserialzing and serializing again?
View the full article
I am writing a windows service which reads xml from a folder and processed to the tables in the sql database. I am using 3 layer. I have the following XML Structure
<pre class="prettyprint <?xml version="1.0" encoding="utf-8" ?>
<RootData version="1.0
<User>
<UserItem>
<ID></ID>
<Name></Name>
</UserItem>
</User>
<Account>
<AccountItem>
<ID></ID>
<Name></Name>
</AccountItem>
</Account>
</RootData>[/code]
In my database i have separate table for each section in the xml like User, Account etc. I have business entities for this xml. When new xml came i validate the xml against xsd and deserialize in to the object. The user have multiple item and likewise each
section have multiple item or 0. To avoid loop for inserting the multiple item into the table, after deserialize i check the count of each list and serialize the section into xml (if the count > 0). Then the serialized xml passed to the stored procedure
as a parameter.
Is this the correct way of doing this scenario? Suddenly i thought this question because, i deserialize the xml and again serialize each item and sent to the stored procedure. So this is time consuming process (in performance way) in my mind. Can anyone
guid me on this?
OR any best method like split each section and directly pass as parameter to the stored procedure so that we can avoid deserialzing and serializing again?
View the full article