LINQ to SQL Error:the selected class cannot be deleted because…

When you try to delete a class from the .dbml file in VS designer you might face this error.

Error: the selected class cannot be deleted because it is used as the return type for one or more DataContext methods

Reason: Some of the stored procedures added to the .dbml file (Linq to SQL class) has  the selected class as a return type.

Resolution: Delete the stored procedures first  which has this class as return type, then delete the class.

Advertisements

Leave a Reply

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

WordPress.com Logo

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

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s