Subsonic 3.0.0.4 views not working
I went over to the subsonic website and downloaded the version 3.0.0.4. My project 开发者_开发知识库setup went well without errors. I then added the following to access two views in my DB
const string TABLE_SQL=@"SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE='BASE TABLE'
UNION
SELECT TABLE_CATALOG,TABLE_SCHEMA,TABLE_NAME, 'View' TABLE_TYPE
FROM INFORMATION_SCHEMA.VIEWS";
In Visual Studio 2010 I am seeing the views were generated, however when I do the following to test
MsgBox(Accounting.vwVendor.All().Count().ToString())
I get no data. If I run the same for other generated tables, it works fine. I do see the following in VS Immediate Window
A first chance exception of type 'System.InvalidOperationException' occurred in SubSonic.Core.dll
Am I missing something for accessing SQL Server views via SubSonic?
UPDATED: I changed the target framework from Framework 4.0 Client Profile to Framework 3.5 Client Profile, build the solution, changed back the target framework to 4.0, build the solution and it worked!
The modification you list is all that should be needed to access Views with SubSonic. I have even tested it in a new project, and had no issues.
If you post more details about the exception (like the stack trace), perhaps something will stand out.
精彩评论