Still celebrating National IT Professionals Day with 3 months of free Premium Membership. Use Code ITDAY17

x
?
Solved

SQL Server and Embedded Data Classes

Posted on 2014-03-21
2
Medium Priority
?
336 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 2000 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

Will your db performance match your db growth?

In Percona’s white paper “Performance at Scale: Keeping Your Database on Its Toes,” we take a high-level approach to what you need to think about when planning for database scalability.

Question has a verified solution.

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

It is possible to export the data of a SQL Table in SSMS and generate INSERT statements. It's neatly tucked away in the generate scripts option of a database.
Windocks is an independent port of Docker's open source to Windows.   This article introduces the use of SQL Server in containers, with integrated support of SQL Server database cloning.
Viewers will learn how to use the SELECT statement in SQL to return specific rows and columns, with various degrees of sorting and limits in place.
In this seventh video of the Xpdf series, we discuss and demonstrate the PDFfonts utility, which lists all the fonts used in a PDF file. It does this via a command line interface, making it suitable for use in programs, scripts, batch files — any pl…

664 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