Solved

SQL Server and Embedded Data Classes

Posted on 2014-03-21
2
327 Views
Last Modified: 2014-03-22
I have a .Net C# application that uses data classes to manage data to\from database and UI's but for reporting over a WAN area network the stored proc calls back and forth to the database is causing a huge performance hit.

How can I use SQL Server to populated an Complex data class that has multiple embedded classes from the server without having to travel back to the client each time? See pseudo code examples below. When populating the Vendor class, for each Vendor, I have to find all of the Contracts and Projects for that Vendor in several SP calls. That's three separate calls. Is there a way to make one SP call to populate my Vendor Class?

Contract Class
{
      Int VendorID;
      Int ProjectID;
      Int ContractID;
      Decimal ContractAmt;
}

Project Class
{
      Int ProjectID;
      Int ProjectName;
      Date StartDate
      Date EndDate;
}


Vendor Class
{
      Int VendorID;
      string VendorName;
      ....
      String City;
      List<Contract> Contracts
      List<Project> Projects
}
0
Comment
Question by:csalerno
[X]
Welcome to Experts Exchange

Add your voice to the tech community where 5M+ people just like you are talking about what matters.

  • Help others & share knowledge
  • Earn cash & points
  • Learn & ask questions
2 Comments
 
LVL 24

Accepted Solution

by:
Bitsqueezer earned 500 total points
ID: 39947285
Hi,

as SQL Server has powerful methods for that I would try to encode all the data into an XML structure and forward that as nvarchar(MAX) to the SP, you can also get a return structure on the same way and decode that in your frontend (I mainly use VBA as frontend and use the MSXML library to do that, I guess there are better ways using .NET code).

Cheers,

Christian
0
 

Author Closing Comment

by:csalerno
ID: 39947407
Yes, I have discovered sql servers XML PATH feature which looks like it would be a great fit for what I need. Thanks for confirming.
0

Featured Post

Get 15 Days FREE Full-Featured Trial

Benefit from a mission critical IT monitoring with Monitis Premium or get it FREE for your entry level monitoring needs.
-Over 200,000 users
-More than 300,000 websites monitored
-Used in 197 countries
-Recommended by 98% of users

Question has a verified solution.

If you are experiencing a similar issue, please ask a related question

Computer science students often experience many of the same frustrations when going through their engineering courses. This article presents seven tips I found useful when completing a bachelors and masters degree in computing which I believe may he…
Q&A with Course Creator, Mark Lassoff, on the importance of HTML5 in the career of a modern-day developer.
Via a live example, show how to setup several different housekeeping processes for a SQL Server.
In this fourth video of the Xpdf series, we discuss and demonstrate the PDFinfo utility, which retrieves the contents of a PDF's Info Dictionary, as well as some other information, including the page count. We show how to isolate the page count in a…

623 members asked questions and received personalized solutions in the past 7 days.

Join the community of 500,000 technology professionals and ask your questions.

Join & Ask a Question