[Okta Webinar] Learn how to a build a cloud-first strategyRegister Now

x
  • Status: Solved
  • Priority: Medium
  • Security: Public
  • Views: 614
  • Last Modified:

Linq2Sql executing stored procedures (Silverlight)

Hi

I'm trying to retrieve whole custom table from a stored procedure ( SLClient_ContractPage() ) in (.Net C# Silverlight), but with no success so far;

Using the ORM designer (drag-drop stored procedure, recreated the dbml file)

Created funciton in the DomainService (web project):

public IList<SLClient_ContractPageResult> SP_ContractsData()
        {
            return this.Context.SLClient_ContractPage().ToList<SLClient_ContractPageResult>();
        }

Then, from DomainContext (on silverlight project), when I execute the above method and gather the results, the number of it is proper (105 records in my case), but only one record is repeated 105 times!

I debugged the situation, and seen that on the server I have retrieved the all data, but on the client only the first record is repeating itself for as many times as there is data in the server...

Can you tell me what could cause this situation?
0
VoxSis
Asked:
VoxSis
1 Solution
 
Bob LearnedCommented:
If you execute the stored procedure, and don't convert it to an IList, do you get the correct results?
0
 
VoxSisAuthor Commented:
Hi,

The actual mistake was in the metadata file, where I give the [Key] attribute to property;
Well, after marking the right property with the [Key] attribute, everything worked fine;

Thanks to TheLearnedOne for the interest
0

Featured Post

Independent Software Vendors: We Want Your Opinion

We value your feedback.

Take our survey and automatically be enter to win anyone of the following:
Yeti Cooler, Amazon eGift Card, and Movie eGift Card!

Tackle projects and never again get stuck behind a technical roadblock.
Join Now