5

How to document the classes & properties & functions that are generated automatically using LINQ to SQL DBML?

I managed to provide documentation to the datacontext class by defining the same partial class in another file with <summary> so it won't be removed if the DBML got refreshed

/// <summary>  
/// Linq to SQL datacontext  
/// </summary>  
public partial class LinqDBDataContext {  

}

This would work for table mapping class with one downside is having to manually maintain the separate class for added/removed tables.

another thing..I have comments-like-documentation(author, date and description) in the stored procedure, shouldn't be also extracted into the code file as the function's documentation?

-- =============================================
-- Author:      <Katia Aleid>
-- Create date: <2015-04-01>
-- Description: <Performs search for the users>
-- =============================================
ALTER PROCEDURE [dbo].[SearchUsers] ....

is it acceptable to exclude the DBML form C# documentation and have separate database documentation instead?

1 Answer 1

1

Comments inside a stored procedure are unlikely to be parseable by SqlMetal; at a push, it could access the MS_Description extended metadata, if you've assigned some - however, I would not expect it to do that. Looking inside the dbml metadata, there isn't anywhere obvious to store or edit additional comments, so frankly I suspect the answer here is: you don't. You shouldn't edit the *.designer.cs, because that can be regenerated at random.

Sign up to request clarification or add additional context in comments.

2 Comments

Thanks for your answer. I didn't mean that the comment were inside the procedure but before it. just like the template provided by SQL server when you request a new procedure. and as for the designer, I know I shouldn't edit it, that's why I add another file to extent the partial class.
@katia those comments are not obtainable by inspection - they are for the benefit of the file, not the SQL Server. Comments inside the stored procedure may be available via sp_helptext etc, but that doesn't make them consumable

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.