Exemplo n.º 1
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);
        }
Exemplo n.º 2
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);
        }