LINQ to SQL – mapping multiple resultsets to the same type

Apparantly LINQ to SQL doesn’t really support mapping multiple resultsets to the same .net type.

My situation is like this:
The stored procedure returns 4 resultsets and I want to map the first 3 sets to the same .net type. Those 3 resultsets also have different column names and different amount of columns.

The thing is, you can define the mappings but LINQ to SQL will always use the first mapping that was defined for for that .net type.

A workaround is to change the stored procedure so that the resultsets that you want to map to the same type always have the same number of columns and have the same column names.

Advertisement
This entry was posted in .NET and tagged , . Bookmark the permalink.

Leave a Reply

Fill in your details below or click an icon to log in:

Gravatar
WordPress.com Logo

Please log in to WordPress.com to post a comment to your blog.

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Connecting to %s