Ejemplo n.º 1
0
        /// <summary>
        /// Adds an entity container element to this entity container.
        /// </summary>
        /// <param name="element">The element to add.</param>
        public void AddElement(IEdmEntityContainerElement element)
        {
            EdmUtil.CheckArgumentNull(element, "element");

            this.containerElements.Add(element);

            switch (element.ContainerElementKind)
            {
            case EdmContainerElementKind.EntitySet:
                RegistrationHelper.AddElement((IEdmEntitySet)element, element.Name, this.entitySetDictionary, RegistrationHelper.CreateAmbiguousEntitySetBinding);
                break;

            case EdmContainerElementKind.Singleton:
                RegistrationHelper.AddElement((IEdmSingleton)element, element.Name, this.singletonDictionary, RegistrationHelper.CreateAmbiguousSingletonBinding);
                break;

            case EdmContainerElementKind.ActionImport:
            case EdmContainerElementKind.FunctionImport:
                RegistrationHelper.AddOperationImport((IEdmOperationImport)element, element.Name, this.operationImportDictionary);
                break;

            case EdmContainerElementKind.None:
                throw new InvalidOperationException(Strings.EdmEntityContainer_CannotUseElementWithTypeNone);

            default:
                throw new InvalidOperationException(Strings.UnknownEnumVal_ContainerElementKind(element.ContainerElementKind));
            }
        }
Ejemplo n.º 2
0
        /// <summary>
        /// Computes the the cached dictionary of properties for this type definition.
        /// </summary>
        /// <returns>Dictionary of properties keyed by their name.</returns>
        private IDictionary <string, IEdmProperty> ComputePropertiesDictionary()
        {
            Dictionary <string, IEdmProperty> properties = new Dictionary <string, IEdmProperty>();

            foreach (IEdmProperty property in this.Properties())
            {
                RegistrationHelper.RegisterProperty(property, property.Name, properties);
            }

            return(properties);
        }
Ejemplo n.º 3
0
 /// <summary>
 /// Adds a schema element to this model.
 /// </summary>
 /// <param name="element">The element to register.</param>
 protected void RegisterElement(IEdmSchemaElement element)
 {
     EdmUtil.CheckArgumentNull(element, "element");
     RegistrationHelper.RegisterSchemaElement(element, this.schemaTypeDictionary, this.termDictionary, this.functionDictionary, this.containersDictionary);
 }