Ejemplo n.º 1
0
            private IEdmEnumType BuildEdmEnumType(EnumTypeElement enumTypeElement)
            {
                var enumType = new EdmEnumType(_namespaceName, enumTypeElement.ResolveName(), Convert(enumTypeElement.UnderlyingType), false);

                foreach (var member in enumTypeElement.Members)
                {
                    enumType.AddMember(member.Key, new EdmIntegerConstant(member.Value));
                }

                return(enumType);
            }
Ejemplo n.º 2
0
        private static Type CreateEnum(ModuleBuilder moduleBuilder, EnumTypeElement element)
        {
            var typeName       = element.ResolveName();
            var underlyingType = ConvertType(element.UnderlyingType);

            var typeBuilder = moduleBuilder.DefineEnum(typeName, underlyingType);

            foreach (var member in element.Members)
            {
                typeBuilder.DefineLiteral(member.Key, Convert.ChangeType(member.Value, underlyingType));
            }

            return(typeBuilder.CreateType());
        }
Ejemplo n.º 3
0
            private IEdmEnumType ResolveEnumType(EnumTypeElement enumTypeElement)
            {
                var typeName = enumTypeElement.ResolveName();

                IEdmSchemaType enumType;

                if (!_registeredTypes.TryGetValue(typeName, out enumType))
                {
                    _registeredTypes.Add(typeName, enumType = BuildEnumType(typeName, enumTypeElement));

                    AnnotateElement(enumType, enumTypeElement.Identity.Id);
                }

                return((IEdmEnumType)enumType);
            }
Ejemplo n.º 4
0
            private IEdmEnumType ResolveEnumType(EnumTypeElement enumTypeElement)
            {
                var typeName = enumTypeElement.ResolveName();

                IEdmSchemaType enumType;
                if (!_registeredTypes.TryGetValue(typeName, out enumType))
                {
                    _registeredTypes.Add(typeName, enumType = BuildEnumType(typeName, enumTypeElement));

                    AnnotateElement(enumType, enumTypeElement.Identity.Id);
                }

                return (IEdmEnumType)enumType;
            }
Ejemplo n.º 5
0
        private static Type CreateEnum(ModuleBuilder moduleBuilder, EnumTypeElement element)
        {
            var typeName = element.ResolveName();
            var underlyingType = ConvertType(element.UnderlyingType);

            var typeBuilder = moduleBuilder.DefineEnum(typeName, underlyingType);

            foreach (var member in element.Members)
            {
                typeBuilder.DefineLiteral(member.Key, Convert.ChangeType(member.Value, underlyingType));
            }

            return typeBuilder.CreateType();
        }
Ejemplo n.º 6
0
            private IEdmEnumType BuildEdmEnumType(EnumTypeElement enumTypeElement)
            {
                var enumType = new EdmEnumType(_namespaceName, enumTypeElement.ResolveName(), Convert(enumTypeElement.UnderlyingType), false);

                foreach (var member in enumTypeElement.Members)
                {
                    enumType.AddMember(member.Key, new EdmIntegerConstant(member.Value));
                }

                return enumType;
            }