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);
            }
        }
Beispiel #2
0
        private void Process_Interace_Property_Declaration(InterfacePropertyDeclaration node)
        {
            if (node == null) throw new ArgumentNullException("node");

            if (node.IsIndexer)
            {
                InterfaceIndexer inter = new InterfaceIndexer(controller);
                inter.DataType = FormatterUtility.GetDataTypeFromTypeReference(node.ReturnType, document, controller);
                foreach (ParameterDeclaration paramNode in node.Parameters)
                {
                    inter.Parameters.Add(GetParameterFromParameterDeclaration(document, controller, paramNode));
                }

                SetupBaseConstruct(node, inter);
            }
            else
            {
                InterfaceProperty inter = new InterfaceProperty(controller, node.Name.Text);
                inter.DataType = FormatterUtility.GetDataTypeFromTypeReference(node.ReturnType, document, controller);

                SetupBaseConstruct(node, inter);
            }
        }