有没有办法强制刷新 SubSonic 在数据库中的 DDL 更改后构建的元模型
例如,当我添加新表时,它不会出现在 Northwind 命名空间中,直到我从中删除项目文件夹: C:\Users\userName\AppData\Local\Temp\Temporary ASP.NET Files\
或添加并读取 SubSonic.dll
我有以下配置:
<configSections>
<section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic"></section>
....
<SubSonicService defaultProvider="Northwind">
<providers>
<clear/>
<add name="Northwind"
type="SubSonic.SqlDataProvider, SubSonic"
connectionStringName="Northwind"
generatedNamespace="Northwind"/>
</providers>
</SubSonicService>
<connectionStrings>
<add name="Northwind" connectionString="Data Source=.;Database=Northwind;Integrated Security=true;"/>
</connectionStrings>
....
<compilation debug="true">
<buildProviders>
<add extension=".abp" type="SubSonic.BuildProvider, SubSonic"/>
</buildProviders>
...
<pages>
<controls>
<add assembly="SubSonic" namespace="SubSonic" tagPrefix="subsonic"/>
E.g. when I add a new table it does not appear in the Northwind namespace untill I remove the project folder from :
C:\Users\userName\AppData\Local\Temp\Temporary ASP.NET Files\
or add and readd the SubSonic.dll
I have the following configuration :
<configSections>
<section name="SubSonicService" type="SubSonic.SubSonicSection, SubSonic"></section>
....
<SubSonicService defaultProvider="Northwind">
<providers>
<clear/>
<add name="Northwind"
type="SubSonic.SqlDataProvider, SubSonic"
connectionStringName="Northwind"
generatedNamespace="Northwind"/>
</providers>
</SubSonicService>
<connectionStrings>
<add name="Northwind" connectionString="Data Source=.;Database=Northwind;Integrated Security=true;"/>
</connectionStrings>
....
<compilation debug="true">
<buildProviders>
<add extension=".abp" type="SubSonic.BuildProvider, SubSonic"/>
</buildProviders>
...
<pages>
<controls>
<add assembly="SubSonic" namespace="SubSonic" tagPrefix="subsonic"/>
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
这里的问题是,除非您更改 App_Code 中的 abp 文件,否则 BuildProvider 不会“关闭”。 这是一个黑客,但如果你想让它工作,你需要打开该文件并通过添加空格或其他东西以某种方式更改它 - 然后它将启动构建器。
我正在开发一些 T4 模板,因此您不必这样做。 另外 - 您可以使用我们的命令行工具生成要为您归档的内容:
http://subsonicproject.com/subcommander/using-the-command -line-tool-subcommander/
The issue here is that the BuildProvider doesn't "go off" unless you change the abp file in App_Code. It's a hack, but if you want it to work you need to open that file up and change it somehow by adding a space or something - then it will kick off the builder.
I'm working on some T4 templates so you don't have to do this. Also - you can use our commandline tool to generate the stuff to file for you:
http://subsonicproject.com/subcommander/using-the-command-line-tool-subcommander/
谢谢,两者都有效!
正如您所说,只需更改 *.abp 文件(添加几个空格)
或
sonic.exe 生成 /config "D:\path\to\my\web.config"
PS
我有一个 D:\temp\utils 文件夹,其中保存了所有使用的命令行工具...并且它是 %PATH% 环境变量的一部分...
我花了几分钟才意识到我必须将整个 :
D:\libs\orm\SubSonic_2.1_Final_Source\src\SubSonic\bin\Debug 目录复制到该命令行工具文件夹...
编辑:甚至更快VS 外部工具命令:
工具-外部工具-添加
作品名称:亚音速
命令:D:\path\to\sonic.exe
参数:生成 /config "D:\path\to\my\web.config"
初始目录:{$ProjectDir}
工具 - 选项 - 键盘
查找 Subsonic 工具
,使其可以在命令行上的任何位置工作
Thanks, both worked !
Either as you said to simply change the *.abp file ( added couple of spaces)
or
sonic.exe generate /config "D:\path\to\my\web.config"
P.S.
I have a D:\temp\utils folder , where I keep all the command line tools used ... and it is part of the %PATH% environmental variable ...
and it took me couple of minutes to realize that I had to copy the whole :
D:\libs\orm\SubSonic_2.1_Final_Source\src\SubSonic\bin\Debug directory to that command line tools folder ...
Edit: Even faster with VS External Tool command :
Tools - External Tools - Add
Title: SubSonic
Command: D:\path\to\sonic.exe
Arguments: generate /config "D:\path\to\my\web.config"
Initial Directory: {$ProjectDir}
Tools - Options - Keyboard
Find tools Subsonic
for it to work from anywhere on the command line