Ejemplo n.º 1
0
        public override void Initialize(CodeFileGenerator codeFileGenerator)
        {
            var nodeConfig = InvertApplication.Container.GetNodeConfig <TData>();

            if (!nodeConfig.TypeGeneratorConfigs.ContainsKey(this.GetType()))
            {
                return;
            }

            GeneratorConfig = nodeConfig.TypeGeneratorConfigs[this.GetType()] as NodeGeneratorConfig <TData>;
            if (GeneratorConfig == null)
            {
                return;
            }
            if (GeneratorConfig.Condition != null && !GeneratorConfig.Condition(Data))
            {
                return;
            }
            base.Initialize(codeFileGenerator);


            Decleration = new CodeTypeDeclaration(IsDesignerFile ? NameAsDesignerClass : NameAsClass)
            {
                IsPartial = true
            };
            Compose();
        }
Ejemplo n.º 2
0
        public override void Initialize(CodeFileGenerator codeFileGenerator)
        {
            base.Initialize(codeFileGenerator);
            _unit = codeFileGenerator.Unit;
            _ns   = codeFileGenerator.Namespace;

            TryAddNamespace("System");
            TryAddNamespace("System.Collections");
            TryAddNamespace("System.Collections.Generic");
            TryAddNamespace("System.Linq");
        }
Ejemplo n.º 3
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();
                }
            }
        }
 public void Initialize(CodeFileGenerator codeFileGenerator, Predicate <IDiagramNodeItem> itemFilter = null)
 {
 }
Ejemplo n.º 5
0
 public virtual void Initialize(CodeFileGenerator codeFileGenerator)
 {
 }