コード例 #1
0
        public override void Initialize(CodeFileGenerator codeFileGenerator)
        {
            base.Initialize(codeFileGenerator);
            //if (!string.IsNullOrEmpty(TemplateType.Namespace))
            //    TryAddNamespace(TemplateType.Namespace);
            Decleration = TemplateType.ToClassDecleration();

            var inheritable = Data as GenericInheritableNode;

            if (!Attribute.AutoInherit)
            {
                inheritable = null;
            }
            if (IsDesignerFile && Attribute.Location != TemplateLocation.DesignerFile)
            {
                Decleration.Name = ClassNameBase(Data as IDiagramNodeItem);
                if (inheritable != null && inheritable.BaseNode != null)
                {
                    Decleration.BaseTypes.Clear();
                    Decleration.BaseTypes.Add(ClassName(inheritable.BaseNode));
                }
            }
            else
            {
                Decleration.Name = ClassName(Data as IDiagramNodeItem);
                if (Attribute.Location != TemplateLocation.DesignerFile)
                {
                    Decleration.BaseTypes.Clear();
                    Decleration.BaseTypes.Add(ClassNameBase(Data as IDiagramNodeItem));
                }
            }

            Namespace.Types.Add(Decleration);

            ProcessTemplate();
            return; // Skip the stuff below for now

            if (IsDesignerFile)
            {
                // base.Initialize(fileGenerator);

                if (IsDesignerFile)
                {
                    InitializeDesignerFile();
                }
                else
                {
                    InitializeEditableFile();
                }
            }
        }