Пример #1
0
 private void WriteIndex(MarshallingContext context, int masterAddress, int position
                         )
 {
     if (_indexedField != null)
     {
         // for now this is a String index only, it takes the entire slot.
         StatefulBuffer buffer = new StatefulBuffer(context.Transaction(), UnblockedLength
                                                        ());
         int blockedPosition = context.Container().BlockConverter().BytesToBlocks(position
                                                                                  );
         int indexID = masterAddress + blockedPosition;
         buffer.SetID(indexID);
         buffer.Address(indexID);
         TransferContentTo(buffer, UnblockedLength());
         _indexedField.AddIndexEntry(context.Transaction(), context.ObjectID(), buffer);
     }
 }
Пример #2
0
            protected override void ProcessAspect(ClassAspect aspect, int currentSlot, bool isNull
                                                  )
            {
                var marshalledObject = obj;

                if (aspect is FieldMetadata)
                {
                    var field = (FieldMetadata)aspect;
                    marshalledObject = field.GetOrCreate(trans, obj);
                    if (marshalledObject == null)
                    {
                        context.IsNull(currentSlot, true);
                        field.AddIndexEntry(trans, context.ObjectID(), null);
                        return;
                    }
                }
                aspect.Marshall(context, marshalledObject);
            }