Пример #1
0
        public void Render(CodeDom.CodeObject target, DesignObject designObject)
        {
            var classDeclaration = (Class)designObject;

            var classCodeObject = new ClassDeclaration
            {
                Name = classDeclaration.Name
            };

            classCodeObject.Scope = classDeclaration.Scope.Convert();
            (target as CodeDom.Module).TypeDeclarations.Add(classCodeObject);

            foreach (var member in classDeclaration.Properties)
            {
                var propertyDeclaration = new PropertyDeclaration
                {
                    Scope    = member.Scope.Convert(),
                    Name     = member.Name,
                    Type     = member.Type.Convert(),
                    Nullable = !member.Required,
                    ReadOnly = member.ReadOnly
                };

                classCodeObject.Properties.Add(propertyDeclaration);
            }
        }
        public void Render(CodeDom.CodeObject target, DesignObject designObject)
        {
            var enumeration = (Enumeration)designObject;

            var enumCodeObject = new EnumerationDeclaration
            {
                Name = enumeration.Name
            };

            (target as CodeDom.Module).TypeDeclarations.Add(enumCodeObject);
            enumCodeObject.Scope = enumeration.Scope.Convert();

            OnRenderEnumDeclaration(enumCodeObject);

            foreach (var member in enumeration.Values)
            {
                var memberDeclaration = new EnumMemberDeclaration
                {
                    Name  = member.Name,
                    Value = member.Value
                };

                OnRenderEnumMemberDeclaration(memberDeclaration);

                enumCodeObject.Values.Add(memberDeclaration);
            }

            OnAfterRenderEnumDeclaration(enumCodeObject);
        }
Пример #3
0
        public void Render(CodeDom.CodeObject target, DesignObject designObject)
        {
            var module = Ensure.Is <CodeDom.Module>(target, nameof(target));

            var entityDeclaration = Ensure.Is <Entity>(designObject, nameof(designObject));

            RenderPoco(module, entityDeclaration);

            var database = ProjectManager.GetDatabase(entityDeclaration.Database);

            RenderTable(database, entityDeclaration);
            RenderRepository(database, entityDeclaration);
        }
Пример #4
0
        private void AnalyzeProcess(Process process)
        {
            Action     func   = process.InitialAction;
            MethodInfo method = func.Method;
            List <ISignalOrPortDescriptor> sens = new List <ISignalOrPortDescriptor>();

            if (process.Sensitivity != null)
            {
                foreach (EventSource e in process.Sensitivity)
                {
                    DesignObject owner = e.Owner;
                    if (!(owner is SignalBase))
                    {
                        _context.Report(EIssueClass.Error,
                                        "Process " + method.Name + " is sensitive to an event which is not owned by " +
                                        "a signal. This is currently not supported by the behavioral model.");
                    }
                    else
                    {
                        var signal = (SignalBase)owner;
                        var spdesc = signal.Descriptor;
                        if (spdesc == null)
                        {
                            throw new InvalidOperationException();
                        }
                        var sref = spdesc.AsSignalRef(SignalRef.EReferencedProperty.Instance)
                                   .RelateToComponent(process.Owner.Descriptor);
                        if (sref == null)
                        {
                            ReportError("Did not find a matching port for signal " + signal.Descriptor.Name);
                        }
                        else
                        {
                            sens.Add(sref.Desc);
                        }
                    }
                }
            }
            ProcessDescriptor pd = new ProcessDescriptor(method, process)
            {
                Sensitivity = sens.ToArray(),
                Owner       = process.Owner.Descriptor
            };

            //DecompileAndEnqueueCallees(pd, process.Owner, new object[] { process.Owner });
            DecompileAndEnqueueCallees(pd, func.Target, new object[] { process.Owner });
            process.Owner.Descriptor.AddChild(pd, method.Name);
        }
        public void Render(CodeObject target, DesignObject designObject)
        {
            var interfaceDeclaration = (Interface)designObject;
            var interfaceCodeObject  = new InterfaceDeclaration
            {
                Name  = interfaceDeclaration.Name,
                Scope = ScopeIdentifier.Public
            };

            (target as CodeDom.Module).TypeDeclarations.Add(interfaceCodeObject);

            foreach (var member in interfaceDeclaration.Properties)
            {
                var propertyDeclaration = new InterfacePropertyDeclaration
                {
                    Name     = member.Name,
                    Type     = member.Type.Convert(),
                    Nullable = !member.Required,
                    ReadOnly = member.ReadOnly
                };

                interfaceCodeObject.Properties.Add(propertyDeclaration);
            }
        }