Example #1
0
        protected void ImplementId()
        {
            MethodInstance template_m_getId = new MethodInstance(null, typeof(RootCacheValue), typeof(Object), "get_Id");
            MethodInstance template_m_setId = new MethodInstance(null, typeof(RootCacheValue), typeof(void), "set_Id", typeof(Object));

            CacheMapEntryVisitor.ImplementNativeField(this, metaData.IdMember, template_m_getId, template_m_setId);
        }
Example #2
0
        protected void ImplementVersion()
        {
            MethodInstance template_m_getVersion = new MethodInstance(null, typeof(RootCacheValue), typeof(Object), "get_Version");
            MethodInstance template_m_setVersion = new MethodInstance(null, typeof(RootCacheValue), typeof(void), "set_Version", typeof(Object));

            CacheMapEntryVisitor.ImplementNativeField(this, metaData.VersionMember, template_m_getVersion, template_m_setVersion);
        }
Example #3
0
        protected void ImplementPrimitives()
        {
            Member[]        primitiveMembers = metaData.PrimitiveMembers;
            FieldInstance[] f_primitives     = new FieldInstance[primitiveMembers.Length];
            FieldInstance[] f_nullFlags      = new FieldInstance[primitiveMembers.Length];
            Type[]          fieldType        = new Type[primitiveMembers.Length];

            for (int primitiveIndex = 0, size = primitiveMembers.Length; primitiveIndex < size; primitiveIndex++)
            {
                Member member     = primitiveMembers[primitiveIndex];
                Type   realType   = member.RealType;
                Type   nativeType = ImmutableTypeSet.GetUnwrappedType(realType);
                bool   isNullable = true;
                if (nativeType == null)
                {
                    nativeType = realType;
                    isNullable = false;
                }
                if (!nativeType.IsPrimitive)
                {
                    nativeType = typeof(Object);
                }
                if (isNullable)
                {
                    // field is a nullable numeric field. We need a flag field to handle true null case
                    FieldInstance f_nullFlag = ImplementField(new FieldInstance(FieldAttributes.Private, CacheMapEntryVisitor.GetFieldName(member) + "$isNull", typeof(bool)));
                    f_nullFlags[primitiveIndex] = f_nullFlag;
                }
                fieldType[primitiveIndex] = nativeType;
                FieldInstance f_primitive = ImplementField(new FieldInstance(FieldAttributes.Private, CacheMapEntryVisitor.GetFieldName(member), nativeType));
                f_primitives[primitiveIndex] = f_primitive;
            }
            ImplementGetPrimitive(primitiveMembers, f_primitives, f_nullFlags);
            ImplementGetPrimitives(primitiveMembers, f_primitives, f_nullFlags);
            ImplementSetPrimitives(primitiveMembers, f_primitives, f_nullFlags);
        }
Example #4
0
        protected void ImplementRelations()
        {
            RelationMember[] relationMembers = metaData.RelationMembers;
            FieldInstance[]  f_relations     = new FieldInstance[relationMembers.Length];

            for (int relationIndex = 0, size = relationMembers.Length; relationIndex < size; relationIndex++)
            {
                RelationMember member     = relationMembers[relationIndex];
                FieldInstance  f_relation = ImplementField(new FieldInstance(FieldAttributes.Private, CacheMapEntryVisitor.GetFieldName(member), typeof(IObjRef[])));
                f_relations[relationIndex] = f_relation;
            }
            ImplementGetRelations(relationMembers, f_relations);
            ImplementSetRelations(relationMembers, f_relations);
            ImplementGetRelation(relationMembers, f_relations);
            ImplementSetRelation(relationMembers, f_relations);
        }