Esempio n. 1
0
 internal void RemoveAttribute(ClassAttributeInfo cai)
 {
     _attributes.Remove(cai);
     _attributesCache.AttributesByName.Remove(cai.GetName());
 }
Esempio n. 2
0
 internal void AddAttribute(ClassAttributeInfo cai)
 {
     cai.SetId(MaxAttributeId++);
     _attributes.Add(cai);
     _attributesCache.AttributesByName.Add(cai.GetName(), cai);
 }
Esempio n. 3
0
        /// <summary>
        ///   Writes a class attribute info, an attribute of a class
        /// </summary>
        public void WriteClassAttributeInfo(IStorageEngine storageEngine, ClassAttributeInfo cai, bool writeInTransaction)
        {
            FileSystemInterface.WriteInt(cai.GetId(), writeInTransaction);
            FileSystemInterface.WriteBoolean(cai.IsNative(), writeInTransaction);

            if (cai.IsNative())
            {
                FileSystemInterface.WriteInt(cai.GetAttributeType().Id, writeInTransaction);
                if (cai.GetAttributeType().IsArray())
                {
                    FileSystemInterface.WriteInt(cai.GetAttributeType().SubType.Id, writeInTransaction);
                    // when the attribute is not native, then write its class info position
                    if (cai.GetAttributeType().SubType.IsNonNative())
                    {
                        FileSystemInterface.WriteLong(
                            storageEngine.GetSession().GetMetaModel().GetClassInfo(
                                cai.GetAttributeType().SubType.Name, true).ClassInfoId.ObjectId,
                            writeInTransaction); // class info id of array subtype
                    }
                }
                // For enum, we write the class info id of the enum class
                if (cai.GetAttributeType().IsEnum())
                {
                    FileSystemInterface.WriteLong(
                        storageEngine.GetSession().GetMetaModel().GetClassInfo(cai.GetFullClassname(), true).ClassInfoId
                            .ObjectId, writeInTransaction); // class info id
                }
            }
            else
            {
                FileSystemInterface.WriteLong(
                    storageEngine.GetSession().GetMetaModel().GetClassInfo(cai.GetFullClassname(), true).ClassInfoId.
                        ObjectId, writeInTransaction); // class info id
            }

            FileSystemInterface.WriteString(cai.GetName(), writeInTransaction);
            FileSystemInterface.WriteBoolean(cai.IsIndex(), writeInTransaction);
        }