
Return Types of DataContext Methods
When you drag stored procedures and functions from Server Explorer/Database Explorer onto the O/R Designer, the return type of the generated DataContext method differs depending on where you drop the item. Dropping the items directly onto an existing entity class creates a DataContext method with the return type of the entity class; dropping items onto an empty area of the O/R Designer (in either pane) creates a DataContext method that returns an automatically generated type. The automatically generated type that is created has a name that matches the stored procedure or function name and properties that map to the fields returned by the stored procedure or function.
Objects you drag from the database onto the O/R Designer surface will be named automatically, based on the name of the objects in the database. If you drag the same object more than once, a number is appended to the end of the new name that differentiates the names. When database object names contain spaces, or characters not-supported in Visual Basic or C#, the space or invalid character is replaced with an underscore.