本文整理汇总了C#中XObject.AddAnnotation方法的典型用法代码示例。如果您正苦于以下问题:C# XObject.AddAnnotation方法的具体用法?C# XObject.AddAnnotation怎么用?C# XObject.AddAnnotation使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类XObject
的用法示例。
在下文中一共展示了XObject.AddAnnotation方法的4个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetModelItem
internal static void SetModelItem(XObject xobject, EFObject efobject)
{
if (xobject.Annotation<EFObject>() == null)
{
xobject.AddAnnotation(efobject);
}
else
{
xobject.RemoveAnnotations<EFObject>();
xobject.AddAnnotation(efobject);
}
}
示例2: GetNextIdentity
internal static long GetNextIdentity(XObject element)
{
var annotation = element.Annotation<ModelAnnotation>();
if (annotation == null)
{
annotation = new ModelAnnotation();
element.AddAnnotation(annotation);
}
var nextIdentity = annotation.NextIdentity;
annotation.NextIdentity = ++nextIdentity;
return nextIdentity;
}
示例3: BindProperty
private void BindProperty(PropertyInfo property, AstNode parentASTNode, object value, XObject sourceXObject, bool bLateBinding)
{
sourceXObject.AddAnnotation(value);
AstNode astNode = value as AstNode;
if (astNode != null && !bLateBinding)
{
astNode.BoundXElement = sourceXObject;
}
if (property.PropertyType.IsAssignableFrom(value.GetType()))
{
property.SetValue(parentASTNode, value, null);
}
else if (IsContainerOf(typeof(ICollection<object>), property.PropertyType) && property.PropertyType.GetGenericArguments()[0].IsAssignableFrom(value.GetType()))
{
object collection = property.GetValue(parentASTNode, null);
MethodInfo addMethod = collection.GetType().GetMethod("Add");
addMethod.Invoke(collection, new object[] { value });
}
else
{
// TODO: Message.Error("No Binding Mechanism Worked");
}
}
示例4: BindFinalValue
public static void BindFinalValue(PropertyInfo property, object parentItem, object value, XObject sourceXObject, bool definition)
{
sourceXObject.AddAnnotation(value);
Type propertyType = property.PropertyType;
if (CommonUtility.IsContainerOf(typeof(ICollection<object>), propertyType) && propertyType.GetGenericArguments()[0].IsAssignableFrom(value.GetType()))
{
object collection = property.GetValue(parentItem, null);
MethodInfo addMethod = collection.GetType().GetMethod("Add");
addMethod.Invoke(collection, new[] { value });
}
else if (propertyType.IsAssignableFrom(value.GetType()))
{
property.SetValue(parentItem, value, null);
}
else
{
// TODO: Message.Error("No Binding Mechanism Worked");
}
var mappingProvider = value as IXObjectMappingProvider;
if (mappingProvider != null && definition)
{
mappingProvider.BoundXObject = new XObjectMapping(sourceXObject, property.Name);
}
}