views:

28

answers:

1

When working with stored procedures in linq, I can go to my SP and select what type of entity it should be returning. This works fine in most cases, except the time's I'm not sure of what will be returned. If I don't select what type of entity to return i get the standard

return ISingleResult<SP-Name>

I thought I would be able to work with this return type like this:

List<SP-Name> myResult = context.SP-Name("London");

But this gives me an error offcourse, about implicit converting ISingleResult to List.

How should I do to be able to work with this <SP-Name> returntype?

A: 

If you don't specify an entity in your Linq-to-SQL model to be used as the return type for your stored procedure, then Linq-to-SQL autogenerates a type for you.

This is a straight .NET class, so you can inspect its properties and so on - but since it's not one of the entities in you database model, obviously, you cannot save it back to the database and there's no set of that type on your db context, either.

As I said - you can inspect the properties of the return type, you can use that to update other "proper" entities of your Linq-to-SQL model and then save those.

marc_s