本文整理汇总了C#中NeoDatis.SetAttributesDefinitionPosition方法的典型用法代码示例。如果您正苦于以下问题:C# NeoDatis.SetAttributesDefinitionPosition方法的具体用法?C# NeoDatis.SetAttributesDefinitionPosition怎么用?C# NeoDatis.SetAttributesDefinitionPosition使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类NeoDatis
的用法示例。
在下文中一共展示了NeoDatis.SetAttributesDefinitionPosition方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: UpdateClassInfo
public virtual void UpdateClassInfo(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
classInfo, bool writeInTransaction)
{
// first check dependent classes
NeoDatis.Tool.Wrappers.List.IOdbList<NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassAttributeInfo
> dependingAttributes = classInfo.GetAllNonNativeAttributes();
NeoDatis.Odb.Core.Layers.Layer2.Meta.MetaModel metaModel = GetSession().GetMetaModel
();
NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassAttributeInfo cai = null;
for (int i = 0; i < dependingAttributes.Count; i++)
{
cai = dependingAttributes[i];
try
{
NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo existingCI = metaModel.GetClassInfo
(cai.GetFullClassname(), false);
if (existingCI == null)
{
// TODO check if this getClassInfo is ok. Maybe, should
// use
// a buffered one
AddClasses(classIntrospector.Introspect(cai.GetFullClassname(), true));
}
else
{
// FIXME should we update class info?
cai.SetClassInfo(existingCI);
}
}
catch (System.Exception e)
{
throw new NeoDatis.Odb.ODBRuntimeException(NeoDatis.Odb.Core.NeoDatisError.ClassIntrospectionError
.AddParameter(cai.GetFullClassname()), e);
}
}
// To force the rewrite of class info body
classInfo.SetAttributesDefinitionPosition(-1);
long newCiPosition = fsi.GetAvailablePosition();
classInfo.SetPosition(newCiPosition);
WriteClassInfoHeader(classInfo, newCiPosition, writeInTransaction);
WriteClassInfoBody(classInfo, fsi.GetAvailablePosition(), writeInTransaction);
}
示例2: WriteClassInfoBody
/// <summary>Write the class info body to the database file.</summary>
/// <remarks>
/// Write the class info body to the database file. TODO Check if we really
/// must recall the writeClassInfoHeader
/// </remarks>
/// <param name="classInfo"></param>
/// <param name="position">The position</param>
/// <param name="writeInTransaction"></param>
/// <></>
public virtual void WriteClassInfoBody(NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassInfo
classInfo, long position, bool writeInTransaction)
{
if (NeoDatis.Odb.OdbConfiguration.IsDebugEnabled(LogId))
{
NeoDatis.Tool.DLogger.Debug(DepthToSpaces() + "Writing new Class info body at " +
position + " : " + classInfo.ToString());
}
// updates class info
classInfo.SetAttributesDefinitionPosition(position);
// FIXME : change this to write only the position and not the whole
// header
WriteClassInfoHeader(classInfo, classInfo.GetPosition(), writeInTransaction);
fsi.SetWritePosition(position, writeInTransaction);
// block definition
fsi.WriteInt(0, writeInTransaction, "block size");
fsi.WriteByte(NeoDatis.Odb.Impl.Core.Layers.Layer3.Block.BlockTypes.BlockTypeClassBody
, writeInTransaction);
// number of attributes
fsi.WriteLong(classInfo.GetAttributes().Count, writeInTransaction, "class nb attributes"
, NeoDatis.Odb.Impl.Core.Transaction.DefaultWriteAction.DataWriteAction);
NeoDatis.Odb.Core.Layers.Layer2.Meta.ClassAttributeInfo cai = null;
for (int i = 0; i < classInfo.GetAttributes().Count; i++)
{
cai = classInfo.GetAttributes()[i];
WriteClassAttributeInfo(cai, writeInTransaction);
}
int blockSize = (int)(fsi.GetPosition() - position);
WriteBlockSizeAt(position, blockSize, writeInTransaction, classInfo);
}