I just wanted to add that in addition to descriptive inline comments in the generated T-SQL it would also be very nice to be able to use comments in M to generate T-sql extended propertymetadata/descriptions. A bit like how XML comments can be used in C# to generate documentation...
E.g.
///<ExtProp type="MS_Description">The RefData schema contains all reference tables and types</ExtProp>
module RefData
{
///<ExtProp type="MS_Description">The IdentifyingCode type is used in reference tables with a relatively static small set of values as the primary key</ExtProp>
type IdentifyingCode: Text#10; //general identifying code
///<ExtProp type="MS_Description">The Description type holds a short textual description of refdata</ExtProp>
type Description: Text#255; //descriptive text
///<ExtProp type="MS_Description>Fields using the ActiveStatus type denotes record status for reference data; active/inactive/deleted</ExtProp>
type ActiveStatus: (Text#1) where value in {"A", "I", "D"}; //denotes record status, active/inactive/deleted
//4.1.2: Seasons
///<ExtProp type="MS_Description">Season ref table containing the definitions (start/end/description) of schedule seasons</ExtProp>
type SeasonType
{
SeasonCode: RefData.IdentifyingCode;
SeasonDescription: Description;
Status: ActiveStatus;
SeasonStartDate: DateTime;
SeasonEndDate: DateTime;
} where identity SeasonCode;
Season: SeasonType*;
}
....and in the T-SQL get matching sp_addextendedproperty / sp_updateextendedproperty calls for the extended properties contained in xml comments (or attributes, or whatever would be the preferred way to include them in the model).
exec sp_addextendedproperty @name = N'MS_Description', @value = 'The RefData schema contains all reference tables and types', @level0type = N'Schema', @level0name = N'RefData'
go
exec sp_addextendedproperty @name = N'MS_Description', @value = 'Season ref table containing the definitions (start/end/description) of schedule seasons', @level0type = N'Schema', @level0name = N'RefData', @level1type = N'Table', @level1name = N'Season'
go
...but of course not
only descriptions, but also other (user defined) SQL Server extended properties...
Kristofer - Huagati Systems Co., Ltd. - Cool tools for Linq-to-SQL and Entity Framework:
www.huagati.com/dbmltools (VS designer add-in),
www.huagati.com/L2SProfiler (query profiler for L2S)