Subsonic 亚音速3包括电缆配置

Subsonic 亚音速3包括电缆配置,subsonic,subsonic3,Subsonic,Subsonic3,在配置中,有一种方法可以设置要排除的表,但我需要的是设置要包括的表的名称,排除所有其他内容 有人已经这样做了吗 干杯! 亚历克斯好的,我已经做到了 只是在tt文件的几个地方添加了以下行: 如果(!ExcludeTables.Contains(tbl.Name)) {如果((IncludeTables.Length!=0&&!IncludeTables.Contains(tbl.Name)))继续 ActiveRecord下关系的一条稍有不同的线。tt 如果(!ExcludeTables.Cont

在配置中,有一种方法可以设置要排除的表,但我需要的是设置要包括的表的名称,排除所有其他内容

有人已经这样做了吗

干杯! 亚历克斯

好的,我已经做到了

只是在tt文件的几个地方添加了以下行: 如果(!ExcludeTables.Contains(tbl.Name)) {如果((IncludeTables.Length!=0&&!IncludeTables.Contains(tbl.Name)))继续

ActiveRecord下关系的一条稍有不同的线。tt 如果(!ExcludeTables.Contains(fk.OtherTable)){ 如果((IncludeTables.Length!=0&&!IncludeTables.Contains(fk.OtherTable)))继续

并在设置中添加了以下内容。t包括 字符串[]IncludeTables=新字符串[]{“tableA”,“tableB”}

这很容易实现,但未来的亚音速更新将删除我的自定义。 这可以添加到项目中吗

谢谢! Alex

还有另一个“黑客”,您只需更改设置即可。t包括;只需将字符串[]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();
公共接口ITableExcluder
{
bool包含(字符串表);
bool应排除(字符串表);
bool应包括(字符串表);
}
/// 
///通过编程方式排除表的自定义类。
/// 
公共类TableExcluder:ITableExcluder
{
public bool Contains(字符串tableName)
{
如果(应排除(表名))
返回true;
return!应该包括(tableName);
}
公共bool应排除(字符串表名)
{
开关(表名)
{
案例“系统图”:
案例“BuildVersion”:
返回true;
}
if(tableName.StartsWith(“blog_”))
返回true;
返回false;
}
公共布尔值应包括(字符串表名)
{
返回true;
}
}
//这将替换字符串数组
ITableExcluder ExcludeTables=新的TableExcluder();

有点像黑客,但至少它避免了替换其他文件的一部分!

看起来不错!我会试试看!事实上,我的实现要求更改所有文件上的代码,这在亚音速更新中将是一个问题。