Friday, May 24, 2013
HomeHomeDiscussionsDiscussionsS-Expert 3.0S-Expert 3.0Fix: SqlServerScriptTemplate.tt about description valueFix: SqlServerScriptTemplate.tt about description value
Previous
 
Next
New Post
4/28/2011 3:06 PM
 

Hi,

follow you can find a patch about template file (SqlServerScriptTemplate.tt)

#line 41 "D:\Sculpture 3.0\SExpert\Source\Molds\DatabaseMold\Templates\SqlServerScriptTemplate.tt"

        foreach (IColumn column in element.Columns)

        {

            if(false == string.IsNullOrEmpty(column.Description))

            {

           

            #line default

            #line hidden

            this.Write("-- Create Column \'");

           

            #line 47 "D:\Sculpture 3.0\SExpert\Source\Molds\DatabaseMold\Templates\SqlServerScriptTemplate.tt"

            this.Write(this.ToStringHelper.ToStringWithCulture(column.Name));

           

            #line default

            #line hidden

            this.Write("\' Description\r\n");

           

            #line 48 "D:\Sculpture 3.0\SExpert\Source\Molds\DatabaseMold\Templates\SqlServerScriptTemplate.tt"

            this.Write(this.ToStringHelper.ToStringWithCulture(string.Format(

                CreateScriptResources.AddDescription,

                column.Description.Replace("'","''") , //OLD => column.Description,

                element.SchemaName,

                element.Name,

                column.Name)));

           

            #line default

            #line hidden

            this.Write("\r\n                \r\n");

           

            #line 55 "D:\Sculpture 3.0\SExpert\Source\Molds\DatabaseMold\Templates\SqlServerScriptTemplate.tt"

                

                    }

        }





Regards

 
New Post
5/6/2011 7:41 AM
 
gialan,

Please explain your point of view on adding 'Replace("'","''")' to the description.

Best Regards,

Ahmed Negm - CTO - Sculpture Project
 
New Post
5/6/2011 9:58 AM
 
Because i you don't replace this character the script generated would be:

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'i'll be go?' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TB_TEST', @level2type=N'COLUMN',@level2name=N'Type'

while sould be

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'i''ll be go?' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TB_TEST', @level2type=N'COLUMN',@level2name=N'Type'

Regards



-------------------------------------------------------------------------------------------------

for example this's right:

CREATE TABLE [dbo].[TB_TEST](

 [Type] [nchar](3) NOT NULL,

 [Name] [nvarchar](30) NULL,

 [Id] [int] IDENTITY(1,1) NOT NULL

) ON [PRIMARY]

GO

EXEC sys.sp_addextendedproperty @name=N'MS_Description', @value=N'i''ll be go?' , @level0type=N'SCHEMA',@level0name=N'dbo', @level1type=N'TABLE',@level1name=N'TB_TEST', @level2type=N'COLUMN',@level2name=N'Type'

GO

 
New Post
5/9/2011 1:01 PM
 
Fixed at 3.0.5.2480.

Best Regards,

Tamer Aboraya - Product Manager - Sculpture project
 
Previous
 
Next
HomeHomeDiscussionsDiscussionsS-Expert 3.0S-Expert 3.0Fix: SqlServerScriptTemplate.tt about description valueFix: SqlServerScriptTemplate.tt about description value


DOWNLOAD   |   PRODUCTS   |   STORE   |   SUPPORT   |   BLOG   |   ABOUT
Copyright 2011 by Modelingsoft Corporation