I took some advice from Mark and created my own Comment Code
I created these two functions CreateTableDescription and CreateColumnDescription Code :
/// <summary>
/// Add Descriptions to New Tables and/or Columns
/// </summary>
/// <param name="tableName">Name of Table</param>
/// <param name="tableDescription">Description of Table</param>
/// <returns></returns>
public static string CreateTableDescription(string tableName, string tableDescription )
{
return string.Format("IF NOT EXISTS (SELECT NULL FROM SYS.EXTENDED_PROPERTIES WHERE [major_id] = OBJECT_ID('{0}') AND [name] = N'MS_Description' AND [minor_id] = 0) EXECUTE sp_addextendedproperty N'MS_Description', '{1}', N'SCHEMA', N'dbo', N'TABLE', N'{0}', NULL, NULL ELSE EXECUTE sp_updateextendedproperty N'MS_Description', '{1}', N'SCHEMA', N'dbo', N'TABLE', N'{0}', NULL, NULL", tableName, tableDescription);
}
/// <summary>
/// Updates Descriptions on Tables and Columns
/// </summary>
/// <param name="tableName">Name of Table for Column</param>
/// <param name="columnName">Name of Column</param>
/// <param name="columDescription">Description for Column</param>
/// <returns></returns>
public static string CreateColumnDescription(string tableName, string columnName , string columDescription )
{
return string.Format("IF NOT EXISTS (SELECT NULL FROM SYS.EXTENDED_PROPERTIES WHERE [major_id] = OBJECT_ID('{0}') AND [name] = N'MS_Description' AND [minor_id] = (SELECT [column_id] FROM SYS.COLUMNS WHERE [name] = '{1}' AND [object_id] = OBJECT_ID('{0}'))) EXECUTE sp_addextendedproperty N'MS_Description', '{2}', N'SCHEMA', N'dbo', N'TABLE', N'{0}', N'COLUMN', N'{1}' ELSE EXECUTE sp_updateextendedproperty N'MS_Description', '{2}', N'SCHEMA', N'dbo', N'TABLE', N'{0}', N'COLUMN', N'{1}'", tableName, columnName, columDescription);
}
Then in my Up() of my migrations I run the following as example
RunSqlTransaction(CommonCode.CreateTableDescription("__MigrationHistory", "Database Version History Table - Administration User Only"));
RunSqlTransaction(CommonCode.CreateColumnDescription("__MigrationHistory", "ContextKey", "Defining the Migration Context"));
RunSqlTransaction(CommonCode.CreateColumnDescription("__MigrationHistory", "MigrationId", "Unique Migration Identifier"));
RunSqlTransaction(CommonCode.CreateColumnDescription("__MigrationHistory", "Model", "Binary of the SQL Change Model"));
RunSqlTransaction(CommonCode.CreateColumnDescription("__MigrationHistory", "ProductVersion", "Version of The Database Change"));
the code for the RunSqlTransaction is
private void RunSqlTransaction(string sqlStatement)
{
//split the script on "GO" commands
string[] splitter = new string[] { "\r\nGO\r\n" };
string[] commandTexts = sqlStatement.Split(splitter,
StringSplitOptions.RemoveEmptyEntries);
foreach (string commandText in commandTexts)
{
Sql(commandText.Replace("GO", ""));
}
}