The selected class cannot be deleted because it is used as a return type for one or more DataContext methods

The return type of one or more DataContext methods is the selected entity class. Deleting an entity class that is used as the return type for a DataContext method will cause the compilation of the project to fail. To delete the selected entity class, identify the DataContext methods that use it and set their return types to a different entity class.

To revert the return types of DataContext methods to their original auto-generated types, first delete the DataContext method from the methods pane and then drag the object from Server Explorer/Database Explorer onto the O/R Designer again.

To correct this error

  1. Identify DataContext methods that use the entity class as a return type by selecting a DataContext method in the methods pane and inspecting the Return Type property in the Properties window.

  2. Set the Return Type to a different entity class or delete the DataContext method from the methods pane.

Show: