Jeff-Lewis / codesmith

Automatically exported from code.google.com/p/codesmith
0 stars 0 forks source link

Name Attribute Needed on Stored Procedure and Function #122

Closed GoogleCodeExporter closed 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Generate on a stored procedure with a param name that contains an 
underscore with the template naming to PascalCase.

2. The code in the generated context does not have the attribute Name 
value specified with the underscore to inform LINQ to SQL.

3. Now test that code and you get a failure with SQL out like this:

Currently see:

EXEC @RETURN_VALUE = [MYSCHEMA].[GET_MY_DATA] @myId = @p0
-- @p0: Input BigInt (Size = 0; Prec = 0; Scale = 0) [454]
-- @RETURN_VALUE: Output Int (Size = 0; Prec = 0; Scale = 0) [Null]
-- Context: SqlProvider(Sql2008) Model: AttributedMetaModel Build: 
3.5.30729.1

Should see:

EXEC @RETURN_VALUE = [MYSCHEMA].[GET_MY_DATA] @MY_ID = @p0
-- @p0: Input BigInt (Size = 0; Prec = 0; Scale = 0) [454]
-- @RETURN_VALUE: Output Int (Size = 0; Prec = 0; Scale = 0) [Null]
-- Context: SqlProvider(Sql2008) Model: AttributedMetaModel Build: 
3.5.30729.1

What version of the product are you using? (It's in the 3.1 release.)

Fix:

You can fix this with this line replaced by the following line in the 
DataContext.Generated.cst file:

s.AppendFormat("            [System.Data.Linq.Mapping.Parameter
(DbType=\"{0}\")] ", p.DbType);

s.AppendFormat("            [System.Data.Linq.Mapping.Parameter
(DbType=\"{0}\", Name=\"{1}\")] ", p.DbType, p.Name.TrimStart('@'));

Original issue reported on code.google.com by tyler.je...@gmail.com on 17 Aug 2009 at 7:10

GoogleCodeExporter commented 9 years ago
Fixed with issue 128

Original comment by shannon....@gmail.com on 28 Aug 2009 at 4:11

GoogleCodeExporter commented 9 years ago

Original comment by shannon....@gmail.com on 28 Aug 2009 at 4:11