markrendle / Simple.Data

A light-weight, dynamic data access component for C# 4.0
MIT License
1.33k stars 302 forks source link

Ordering methods don't work when used on a view that is not in the default schema #347

Open rogersillito opened 10 years ago

rogersillito commented 10 years ago

I have a view in SQL Server that is created in a non-default schema (i.e. not dbo):

CREATE VIEW [staff_detail].[vw_iid_redirects]
AS
   SELECT  [iid], [redirected_iid]
   FROM [dbo].[vw_iid_redirects]
GO

when I try to use either of the ways of doing an "ORDER BY" on the view:

db.staff_detail.vw_iid_redirects.All().OrderBy(db.staff_detail.vw_iid_redirects.iid);
db.staff_detail.vw_iid_redirects.All().OrderByiid();

I get:

UnresolvableObjectException Column 'vw_iid_redirects.iid' not found. (inner exception: UnresolvableObjectException, Column 'iid' not found.)

Doing the same things on a table in the dbo schema works as expected.