【问题标题】:Hiding initial value in Imported Database Model of Enterprise Architect在 Enterprise Architect 的导入数据库模型中隐藏初始值
【发布时间】:2013-06-04 10:54:46
【问题描述】:

我目前正在通过将 MS SQL Server 2008 逆向工程到 Sparx 的 Enterprise Architect 版本 10 来创建数据库模型。

我已经能够导入表格,并隐藏不需要的项目(例如操作和原型)。但是,在导入表格或图表属性时,我没有找到隐藏列 Initial 值的选项,这让我可以选择一一编辑每一列(耗时)。

我是否错过了隐藏Initial 值的任何配置?如果不存在这样的配置,那么在没有配置的情况下隐藏/删除初始值的最佳方法是什么?

【问题讨论】:

    标签: sql-server-2008 database-design reverse-engineering enterprise-architect


    【解决方案1】:

    最终通过创建EA脚本得到了解决方案。随意使用和增强它:)

    !INC Local Scripts.EAConstants-JScript
    
    function OnProjectBrowserScript()
    {
        // Show the script output window
        Repository.EnsureOutputVisible( "Script" );
    
        var treeSelectedType = Repository.GetTreeSelectedItemType();
    
        switch ( treeSelectedType )
        {
            case otElement: // if select table
            {
                removeInitial(Repository.GetContextObject());
                break;
            }
            case otPackage: // if select package containing table
            {
                var selectedObject as EA.Element;
                selectedObject = Repository.GetContextObject();
    
                for ( var i = 0 ; i < selectedObject.Elements.Count ; i++ )
                {
                    removeInitial(selectedObject.Elements.GetAt( i ));
                }
                break;
            }
            default:
            {
                // Error message
                Session.Prompt( "This script does not support items of this type.", promptOK );
            }
        }
    }
    
    function removeInitial(selectedObject)
    {
        for (var i = 0 ; i < selectedObject.Attributes.Count; i++)
        {
            var attrib as EA.Attribute;
            attrib = selectedObject.Attributes.GetAt(i);
            attrib.Default = "";
            attrib.Update();
        }
        Session.Output("finished updating " + selectedObject.Name);
    
    }
    
    OnProjectBrowserScript();
    

    【讨论】:

      猜你喜欢
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      • 1970-01-01
      相关资源
      最近更新 更多