1
A
回答
1
好吧,我已經做到了......
只是添加以下行的TT文件的幾個地方: 如果 (ExcludeTables.Contains(tbl.Name)!) {if((IncludeTables.Length!= 0 & &!IncludeTables.Contains(tbl.Name)))continue;
上ActiveRecord.tt 下關係略微不同的行,如果(!ExcludeTables.Contains(fk.OtherTable)){ 如果((IncludeTables.Length!= 0 & &!IncludeTables.Contains(FK .OtherTable)))繼續;
和加在settings.ttinclude以下 串[] IncludeTables =新的字符串[] { 「表A」, 「tableB的」};
這很容易實現,但未來的SubSonic更新將抹去我的定製。 這可以添加到項目中嗎?
謝謝! 亞歷克斯
1
還有另一個「黑客」,你只需要改變Settings.ttinclude;只需更換的String [] ExcludeTables ...有:
public interface ITableExcluder
{
bool Contains(string table);
bool ShouldExclude(string table);
bool ShouldInclude(string table);
}
/// <summary>
/// Custom class to exclude tables via a programmatic means.
/// </summary>
public class TableExcluder : ITableExcluder
{
public bool Contains(string tableName)
{
if (ShouldExclude(tableName))
return true;
return !ShouldInclude(tableName);
}
public bool ShouldExclude(string tableName)
{
switch (tableName)
{
case "sysdiagrams":
case "BuildVersion":
return true;
}
if (tableName.StartsWith("blog_"))
return true;
return false;
}
public bool ShouldInclude(string tableName)
{
return true;
}
}
//This replaces the string array
ITableExcluder ExcludeTables = new TableExcluder();
一個黑客一點,但至少它避免了其他文件的更換零件!
相關問題
- 1. subsonic 3 oracle
- 2. Subsonic 3 - 更新NullReferenceException
- 3. SubSonic 3.0.0.2/3 | SimpleRepository
- 4. Subsonic 3 LeftOuterJoin
- 5. GroupBy Countwith Subsonic 3
- 6. SubSonic 3 and inlinequery
- 7. Oracle,Subsonic 3和TableSpaceName
- 8. SubSonic 3安裝問題?
- 9. Subsonic 3 VS實體框架
- 10. SubSonic 3 Repository - SQLite In-Memory
- 11. Subsonic 3 ActiveRecord Setup()行爲
- 12. SubSonic 3 + ActiveRecord問題入門
- 13. SubSonic 3和WebApplication安裝
- 14. SubSonic 3.0.0.2/3 | Structs.tt問題
- 15. SubSonic 3中的Casting問題
- 16. Subsonic 3和Adjacency模型
- 17. Subsonic 3與Oracle支持
- 18. SubSonic 3 Visual Studio插件
- 19. subsonic 3.Save()VS.Update()和.Add()
- 20. 定義SubSonic 3 ActiveRecord遷移
- 21. Subsonic 3和腳手架
- 22. Inner Subsonic與subsonic
- 23. Subsonic 3等效的Subsonic 2 SetColumnValue和GetColumnValue ActiveRecord
- 24. SubSonic 3測試數據庫「SubSonic」在哪裏?
- 25. Subsonic 3 - 序列不包含匹配元素
- 26. Subsonic 3/ASP.NET MVC中的ForeignKeyTo屬性?
- 27. Subsonic 3 t4模板無法編譯
- 28. SubSonic 3 ActiveRecord遷移忽略外鍵
- 29. 簡單的SubSonic 3世代問題
- 30. SubSonic 3 Step by Step WinForm應用程序VB.Net生成和設置
看起來不錯!我會嘗試的! 實際上,我的實現要求更改所有文件上的代碼,這些問題將成爲SubSonic更新的問題。 – AlexCode 2009-08-19 08:57:30