コード例 #1
0
        /// <summary>
        /// register an extension attribute on the Application specified by StringConstants.AppObjectId
        /// this version only registers a string extension attribute on users
        /// </summary>
        /// <param name="strExtension">extension name</param>
        /// <param name="strErrors">error return value</param>
        /// <returns>success or failure</returns>
        public bool RegisterExtension(string strExtension, ref string strErrors)
        {
            // setup the extension definition
            ExtensionDefinition extension = new ExtensionDefinition();

            extension.name     = strExtension;
            extension.dataType = "String";
            extension.targetObjects.Add("User");

            // Execute the POST to create new extension
            ExtensionDefinition returnedExtension = this.graphCall.createExtension(extension, ref strErrors);

            return(returnedExtension != null);
        }
コード例 #2
0
 public HomeController(ExtensionDefinition definition, ApplicationConfiguration settings)
     : base(definition)
 {
     this.settings = settings;
 }
コード例 #3
0
 public HelloWorld(ExtensionDefinition extensionDefinition) : base(extensionDefinition)
 {
 }
コード例 #4
0
        public SDNodeType GetNodeType()
        {
            if (IsSetupSlice)
            {
                return(SDNodeType.SetupSlice);
            }

            ElementDefinitionType[] types = GetElementDefinitionType();

            if (types != null)
            {
                if (types.Length == 0)
                {
                    return(SDNodeType.Unknown);
                }
                else if (types.Length == 1)
                {
                    ElementDefinitionType elementType = types.Single();

                    if (elementType.IsBackboneElement())
                    {
                        return(SDNodeType.Element);
                    }
                    else if (elementType.IsPrimitiveType())
                    {
                        return(SDNodeType.PrimitiveType);
                    }
                    else if (elementType.IsReference())
                    {
                        return(SDNodeType.Reference);
                    }
                    else if (elementType.IsComplexType())
                    {
                        return(SDNodeType.ComplexType);
                    }
                    else if (elementType.IsExtension())
                    {
                        if (ExtensionDefinition != null)
                        {
                            if (ExtensionDefinition.IsComplexExtension())
                            {
                                return(SDNodeType.ComplexExtension);
                            }
                        }

                        return(SDNodeType.SimpleExtension);
                    }
                    else if (elementType.IsResource())
                    {
                        return(SDNodeType.Resource);
                    }

                    return(SDNodeType.Unknown);
                }
                else
                {
                    if (types.Any(t => t.IsReference()))
                    {
                        return(SDNodeType.Reference);
                    }

                    return(SDNodeType.Choice);
                }
            }
            else if ((Element.PathBeforeSliceIndexing ?? string.Empty).EndsWith(".extension"))
            {
                // hacky but apparently only way to determine extensions within extensions

                return(SDNodeType.SimpleExtension);
            }
            else if (Element.nameReference != null)
            {
                return(SDNodeType.ReferenceToAnotherElement);
            }

            return(SDNodeType.Unknown);
        }