本文整理汇总了C#中Db4objects.Db4o.Internal.ObjectReference.ClassMetadata方法的典型用法代码示例。如果您正苦于以下问题:C# ObjectReference.ClassMetadata方法的具体用法?C# ObjectReference.ClassMetadata怎么用?C# ObjectReference.ClassMetadata使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Db4objects.Db4o.Internal.ObjectReference
的用法示例。
在下文中一共展示了ObjectReference.ClassMetadata方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: WriteAndRead
private object WriteAndRead(object obj)
{
var imaginativeID = 500;
var @ref = new ObjectReference(ClassMetadataForObject(obj), imaginativeID
);
@ref.SetObject(obj);
var marshallingContext = new MarshallingContext(Trans(), @ref, Container
().UpdateDepthProvider().ForDepth(int.MaxValue), true);
Handlers4.Write(@ref.ClassMetadata().TypeHandler(), marshallingContext, obj);
var pointer = marshallingContext.AllocateSlot();
var buffer = marshallingContext.ToWriteBuffer(pointer);
buffer.Seek(0);
// String str = new String(buffer._buffer);
// System.out.println(str);
var unmarshallingContext = new UnmarshallingContext(Trans(), @ref
, Const4.AddToIdTree, false);
unmarshallingContext.Buffer(buffer);
unmarshallingContext.ActivationDepth(new LegacyActivationDepth(5));
return unmarshallingContext.Read();
}
示例2: Analyze
internal virtual void Analyze(Transaction trans)
{
_ref = trans.ReferenceForObject(_obj);
if (_ref != null)
{
_classMetadata = _ref.ClassMetadata();
return;
}
IReflectClass claxx = _container.Reflector().ForObject(_obj);
if (claxx == null)
{
NotStorable(_obj, claxx);
return;
}
if (!DetectClassMetadata(trans, claxx))
{
return;
}
if (IsValueType(_classMetadata))
{
NotStorable(_obj, _classMetadata.ClassReflector());
}
}
示例3: Delete3
internal void Delete3(Transaction trans, ObjectReference @ref, object obj, int cascade
, bool userCall)
{
// The passed reference can be null, when calling from Transaction.
if (@ref == null || [email protected]())
{
return;
}
// This check is performed twice, here and in delete2, intentionally.
if (BreakDeleteForEnum(@ref, userCall))
{
@ref.EndProcessing();
return;
}
if ([email protected]())
{
@ref.EndProcessing();
return;
}
ClassMetadata yc = @ref.ClassMetadata();
// We have to end processing temporarily here, otherwise the can delete callback
// can't do anything at all with this object.
@ref.EndProcessing();
ActivateForDeletionCallback(trans, yc, @ref, obj);
if (!ObjectCanDelete(trans, yc, @ref))
{
return;
}
@ref.BeginProcessing();
if (DTrace.enabled)
{
DTrace.Delete.Log(@ref.GetID());
}
if (Delete4(trans, @ref, obj, cascade, userCall))
{
ObjectOnDelete(trans, yc, @ref);
if (ConfigImpl.MessageLevel() > Const4.State)
{
Message(string.Empty + @ref.GetID() + " delete " + @ref.ClassMetadata().GetName()
);
}
}
@ref.EndProcessing();
}
示例4: BreakDeleteForEnum
private bool BreakDeleteForEnum(ObjectReference reference, bool userCall)
{
return false;
if (userCall)
{
return false;
}
if (reference == null)
{
return false;
}
return Platform4.IsEnum(Reflector(), reference.ClassMetadata().ClassReflector());
}
示例5: Store2
public int Store2(Transaction trans, object obj, IUpdateDepth updateDepth, bool checkJustSet
)
{
if (obj == null || (obj is ITransientClass))
{
return 0;
}
ObjectAnalyzer analyzer = new ObjectAnalyzer(this, obj);
analyzer.Analyze(trans);
if (analyzer.NotStorable())
{
return 0;
}
ObjectReference @ref = analyzer.ObjectReference();
if (@ref == null)
{
ClassMetadata classMetadata = analyzer.ClassMetadata();
if (!ObjectCanNew(trans, classMetadata, obj))
{
return 0;
}
@ref = new ObjectReference();
@ref.Store(trans, classMetadata, obj);
trans.AddNewReference(@ref);
if (obj is IDb4oTypeImpl)
{
((IDb4oTypeImpl)obj).SetTrans(trans);
}
if (ConfigImpl.MessageLevel() > Const4.State)
{
Message(string.Empty + @ref.GetID() + " new " + @ref.ClassMetadata().GetName());
}
FlagAsHandled(@ref);
StillToSet(trans, @ref, updateDepth);
}
else
{
if (@ref.IsFlaggedAsHandled(_topLevelCallId))
{
AssertNotInCallback();
}
if (CanUpdate())
{
if (checkJustSet)
{
if (([email protected]()) && HandledInCurrentTopLevelCall(@ref))
{
return @ref.GetID();
}
}
if (updateDepth.SufficientDepth())
{
FlagAsHandled(@ref);
@ref.WriteUpdate(trans, updateDepth);
}
}
}
ProcessPendingClassUpdates();
return @ref.GetID();
}
示例6: CanSkip
public override bool CanSkip(ObjectReference @ref)
{
ClassMetadata clazz = @ref.ClassMetadata();
return clazz.Reflector().ForClass(typeof(IActivatable)).IsAssignableFrom(clazz.ClassReflector
()) && !_query.IsModified(@ref.GetObject());
}
示例7: IsStruct
private bool IsStruct(ObjectReference @ref)
{
return @ref.ClassMetadata().IsStruct();
}
示例8: Delete4
public sealed override bool Delete4(Transaction transaction, ObjectReference @ref
, object obj, int cascade, bool userCall)
{
int id = @ref.GetID();
StatefulBuffer reader = ReadStatefulBufferById(transaction, id);
if (reader != null)
{
if (obj != null)
{
if ((!ShowInternalClasses()) && Const4.ClassInternal.IsAssignableFrom(obj.GetType
()))
{
return false;
}
}
reader.SetCascadeDeletes(cascade);
transaction.IdSystem().NotifySlotDeleted(id, SlotChangeFactory.UserObjects);
ClassMetadata classMetadata = @ref.ClassMetadata();
classMetadata.Delete(reader, obj);
return true;
}
return false;
}