Solved

SQL Server and Embedded Data Classes

Posted on 2014-03-21
2
321 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

Free eBook: Backup on AWS

Everything you need to know about backup and disaster recovery with AWS, for FREE!

Question has a verified solution.

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

Suggested Solutions

Title # Comments Views Activity
semaphore timeout period has expired 1 33
SQL Server 2012 and core licensing 5 32
sql server string_split 4 30
Creating Scalar Function 3 20
In this post we will learn how to make Android Gesture Tutorial and give different functionality whenever a user Touch or Scroll android screen.
This article will inform Clients about common and important expectations from the freelancers (Experts) who are looking at your Gig.
Via a live example, show how to shrink a transaction log file down to a reasonable size.
Viewers will learn how to use the UPDATE and DELETE statements to change or remove existing data from their tables. Make a table: Update a specific column given a specific row using the UPDATE statement: Remove a set of values using the DELETE s…

710 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