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?

Katia
  • 679
  • 2
  • 15
  • 42

1 Answers1

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.

Marc Gravell
  • 1,026,079
  • 266
  • 2,566
  • 2,900
  • 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 Apr 14 '15 at 10:13
  • 1
    @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 – Marc Gravell Apr 14 '15 at 10:21