views:

27

answers:

1

Hello, I am using the T4 templates of SubSonic 3.0 to generate classes and such for me. Well in my database I have a Zipcode table with these columns

  • ZipCode_rid
  • Zipcode (the actual zipcode in number format)
  • State
  • etc

Well, when the T4 templates run, instead of having a column like Zipcode.Zipcode I get Zipcode.ZipcodeX. Then, when trying to run a simple query across this table I get the cryptic error

The member 'ZipcodeX' is not supported

The query is something simple like this

var z= from z in Zipcode.All()
       where (z.ZipcodeX == "12345")
       select z;

Is this a bug in SubSonic or am I messing something up? What workarounds are there?

I have temporarily worked around this issue by renaming the Zipcode column to ZipCode.. but this isn't a very good long term solution

+1  A: 

This is both a bug in subsonic and you doing something wrong. Currently subsonic doesn't support columns with the same name as the table that contains them. The template tries to work around this by adding the X to the column name but the subsonic core then blows up.

The fix is to rename your column or table, Zipcode.Zipcode doesn't really make sense to me maybe Zipcode.Code would be more appropriate.

Adam
Not a very good answer, but it is the correct answer.. Regarding your own suggestion, we can't just rename it(other than make it different case) because we are currently in a migration between using an ORM and appending strings to make our own queries..
Earlz