Esempio n. 1
0
 private void locateFields()
 {
     mbr = new MemberInfo[fieldNames.Length];
     for (int i = 0; i < fieldNames.Length; i++)
     {
         Type compType;
         mbr[i] = ClassDescriptor.lookupComponent(cls, fieldNames[i], out compType);
         if (mbr[i] == null)
         {
             throw new StorageError(StorageError.ErrorCode.INDEXED_FIELD_NOT_FOUND, className + "." + fieldNames[i]);
         }
     }
 }
Esempio n. 2
0
        private void lookupField(String name)
        {
            mbr = ClassDescriptor.lookupComponent(cls, fieldName, out mbrType);
            if (mbr == null)
            {
                throw new StorageError(StorageError.ErrorCode.INDEXED_FIELD_NOT_FOUND, className + "." + fieldName);
            }
#if USE_GENERICS
            if (mbrType != typeof(K))
            {
                throw new StorageError(StorageError.ErrorCode.INCOMPATIBLE_KEY_TYPE, mbrType);
            }
#endif
        }
Esempio n. 3
0
        private void locateMembers()
        {
            if (fieldNames == null)
            {
#if WINRT_NET_FRAMEWORK
                members = Enumerable.ToArray <FieldInfo>(cls.GetRuntimeFields());
#else
                members = cls.GetMembers(BindingFlags.Instance | BindingFlags.NonPublic | BindingFlags.Public | BindingFlags.DeclaredOnly);
#endif
            }
            else
            {
                members = new FieldInfo[fieldNames.Length];
                for (int i = 0; i < members.Length; i++)
                {
                    Type mbrType;
                    members[i] = ClassDescriptor.lookupComponent(cls, fieldNames[i], out mbrType);
                }
            }
        }
Esempio n. 4
0
        static KeyMember lookupKey(Type cls, String fieldName)
        {
            KeyMember key;

            key.info = ClassDescriptor.lookupComponent(cls, fieldName, out key.type);
            if (key.info == null)
            {
                throw new StorageError(StorageError.ErrorCode.INDEXED_FIELD_NOT_FOUND, cls.FullName + "." + fieldName);
            }
#if USE_GENERICS
            if (cls != typeof(V))
            {
                throw new StorageError(StorageError.ErrorCode.INCOMPATIBLE_VALUE_TYPE, cls);
            }
            if (key.type != typeof(K))
            {
                throw new StorageError(StorageError.ErrorCode.INCOMPATIBLE_KEY_TYPE, key.type);
            }
#endif
            return(key);
        }