SubSonic 3.0 中的 SQL 视图 [英] SQL Views in SubSonic 3.0
本文介绍了SubSonic 3.0 中的 SQL 视图的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
有什么方法可以访问我在 SubSonic 3.0 中的 SQL 视图?代码生成似乎完全跳过视图
Is there any way that I can access my SQL views in SubSonic 3.0? The code generation seems to skip views altogether
推荐答案
在项目中包含视图
只需打开SQLServer.ttinclude查找加载表的查询(搜索表单 'const string TABLE_SQL')然后将其更改为
simply open SQLServer.ttinclude Find the query that load the tables ( search form 'const string TABLE_SQL') then change it to
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";
如果你在 asp.net 项目中使用它,你可以像这样排除 aspnet 表和视图
if you are using it in an asp.net project you can exclude the aspnet table and views like so
const string TABLE_SQL=@"SELECT *
FROM INFORMATION_SCHEMA.TABLES
WHERE TABLE_TYPE='BASE TABLE'
and table_name not like '%aspnet_%'
union
select Table_catalog, table_schema, table_name, 'View' table_type
from information_schema.views
where table_name not like '%aspnet_%'";
这篇关于SubSonic 3.0 中的 SQL 视图的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文