SubSonic 3 ignoring columns in Select()

Posted by jessegavin on Stack Overflow See other posts from Stack Overflow or by jessegavin
Published on 2010-04-15T17:12:00Z Indexed on 2010/04/15 17:23 UTC
Read the original article Hit count: 630

Filed under:
|

I have a table like so..

CREATE TABLE [dbo].[Locations_Hours](
  [LocationID] [int] NOT NULL,
  [sun_open] [nvarchar](10) NULL,
  [sun_close] [nvarchar](10) NULL,
  [mon_open] [nvarchar](10) NULL,
  [mon_close] [nvarchar](10) NULL,
  [tue_open] [nvarchar](10) NULL,
  [tue_close] [nvarchar](10) NULL,
  [wed_open] [nvarchar](10) NULL,
  [wed_close] [nvarchar](10) NULL,
  [thu_open] [nvarchar](10) NULL,
  [thu_close] [nvarchar](10) NULL,
  [fri_open] [nvarchar](10) NULL,
  [fri_close] [nvarchar](10) NULL,
  [sat_open] [nvarchar](10) NULL,
  [sat_close] [nvarchar](10) NULL,
  [StoreNumber] [int] NULL,
  [LocationHourID] [int] IDENTITY(1,1) NOT NULL,
 CONSTRAINT [PK_Locations_Hours] PRIMARY KEY CLUSTERED 
(
  [LocationHourID] ASC
)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]
) ON [PRIMARY]

And SubSonic 3 is generating a class with the following properties

int LocationID
string monopen
string monclose
string tueopen 
string tueclose
string wedopen 
string wedclose
string thuopen 
string thuclose
string friopen 
string friclose
string satopen 
string satclose
string sunopen 
string sunclose
int? StoreNumber
int LocationHourID

When I try to perform a query against this class like so..

var result = DB.LocationHours.Where(o => o.LocationID == _locationId);

This is the resulting SQL query that SubSonic generates.

SELECT [t0].[LocationHourID], [t0].[LocationID], [t0].[StoreNumber]
FROM [dbo].[Locations_Hours] AS t0
WHERE ([t0].[LocationID] = 4019)

I cannot figure out why SubSonic is omitting the nvarchar fields when it generates the SELECT statement. Anyone got any ideas?

© Stack Overflow or respective owner

Related posts about subsonic3

Related posts about subsonic