private IEnumerable <IEdmEnumMember> ComputeMembers()
        {
            IEdmEnumMember        csdlSemanticsEnumMember;
            List <IEdmEnumMember> edmEnumMembers = new List <IEdmEnumMember>();
            long value = (long)-1;

            foreach (CsdlEnumMember member in this.enumeration.Members)
            {
                long?nullable = member.Value;
                if (nullable.HasValue)
                {
                    long?value1 = member.Value;
                    value = value1.Value;
                    csdlSemanticsEnumMember = new CsdlSemanticsEnumMember(this, member);
                    csdlSemanticsEnumMember.SetIsValueExplicit(this.Model, new bool?(true));
                }
                else
                {
                    if (value >= 0x7fffffffffffffffL)
                    {
                        CsdlSemanticsEnumTypeDefinition csdlSemanticsEnumTypeDefinition = this;
                        string      name          = member.Name;
                        EdmError[]  edmErrorArray = new EdmError[1];
                        EdmError[]  edmError      = edmErrorArray;
                        int         num           = 0;
                        EdmLocation location      = member.Location;
                        EdmLocation edmLocation   = location;
                        if (location == null)
                        {
                            edmLocation = base.Location;
                        }
                        edmError[num]           = new EdmError(edmLocation, EdmErrorCode.EnumMemberValueOutOfRange, Strings.CsdlSemantics_EnumMemberValueOutOfRange);
                        csdlSemanticsEnumMember = new BadEnumMember(csdlSemanticsEnumTypeDefinition, name, edmErrorArray);
                    }
                    else
                    {
                        long?nullable1 = new long?(value + (long)1);
                        value                   = nullable1.Value;
                        member.Value            = nullable1;
                        csdlSemanticsEnumMember = new CsdlSemanticsEnumMember(this, member);
                    }
                    csdlSemanticsEnumMember.SetIsValueExplicit(this.Model, new bool?(false));
                }
                edmEnumMembers.Add(csdlSemanticsEnumMember);
            }
            return(edmEnumMembers);
        }
 public CsdlSemanticsEnumMember(CsdlSemanticsEnumTypeDefinition declaringType, CsdlEnumMember member) : base(member)
 {
     this.valueCache    = new Cache <CsdlSemanticsEnumMember, IEdmPrimitiveValue>();
     this.member        = member;
     this.declaringType = declaringType;
 }
Beispiel #3
0
 public CsdlSemanticsEnumMember(CsdlSemanticsEnumTypeDefinition declaringType, CsdlEnumMember member)
     : base(member)
 {
     this.member        = member;
     this.declaringType = declaringType;
 }
		public CsdlSemanticsEnumMember(CsdlSemanticsEnumTypeDefinition declaringType, CsdlEnumMember member) : base(member)
		{
			this.valueCache = new Cache<CsdlSemanticsEnumMember, IEdmPrimitiveValue>();
			this.member = member;
			this.declaringType = declaringType;
		}
 public CsdlSemanticsEnumMember(CsdlSemanticsEnumTypeDefinition declaringType, CsdlEnumMember member)
     : base(member)
 {
     this.member = member;
     this.declaringType = declaringType;
 }