yasser777 / nettiers

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

GetCSType does not respect the "nullable" parameter when a ColumnSchema is passed in. #204

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What steps will reproduce the problem?
1. Create a table with a nullable column of a type that ends up as a .net
value type. My column was a float.
2. Generate the templates.
3. Examine the BulkInsert method. The DataSet column for the nullable
column will be added as a Nullable<T> which is invalid and causes a runtime
error.

What is the expected output? What do you see instead?

I expect a normal Double to appear in the code. Not a "Double?"

What version of .netTiers and CodeSmith are you using?

CodeSmith 5.x. netTiers 2.3.805

Please provide any additional information below.

In DataAccessLayer.SqlClient\SqlEntityProviderBase.generated.cst

Line 975: GetCSType(cols[i], false) is called. Notice the false. This
presumably indicates to GetCSType that a nullable type is not wanted.

In CommonSqlCode:

Line 3544: Calls GetAliasName(col.Table.Owner, col.Table.Name, col.Name,
ReturnFields.CSType)

GetAliasName merely returns whatever is in the mapping file if a mapping
file is being used. This is not good. The mapping file *must* have the
proper, nullable type, but when GetCSType is called with false for
nullable, GetAliasName has no way of knowing that, and the choice is not
respected.

I added a hack to replace the "?" with "" if nullable is false.

Why is GetAliasName called "GetAliasName" when it does way more than get
table alias names? It should be renamed.

Original issue reported on code.google.com by codemonk...@gmail.com on 23 Apr 2009 at 7:11

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 25 May 2009 at 3:30

GoogleCodeExporter commented 9 years ago

Original comment by bniemyjski on 25 May 2009 at 4:02