本文整理汇总了C#中IDataObject.SetProperty方法的典型用法代码示例。如果您正苦于以下问题:C# IDataObject.SetProperty方法的具体用法?C# IDataObject.SetProperty怎么用?C# IDataObject.SetProperty使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IDataObject
的用法示例。
在下文中一共展示了IDataObject.SetProperty方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: MergeDynamicProperties
/// <summary>
/// Merges dynamic properties of DataObject.
/// </summary>
/// <param name="baseObject">Base DataObject to be merged.</param>
/// <param name="mergingObject">Merging DataObject to be merged into base DataObject.</param>
/// <param name="checkPaths">Consider paths in the merging.</param>
private void MergeDynamicProperties(IDataObject baseObject, IDataObject mergingObject, Boolean checkPaths)
{
baseObject.DynamicType = mergingObject.DynamicType;
DataCache dynamicCache = (DataCache)typeof(DataObject).GetTypeInfo().GetDeclaredField("dynamicCache").GetValue(mergingObject);
foreach (KeyValuePair<String, Object> propertyValue in dynamicCache.GetObjectsInRegion("Properties"))
{
Boolean includePath = true;
if (this.Paths != null)
{
includePath = !checkPaths;
foreach (String path in this.Paths)
{
if (propertyValue.Key == path)
{
includePath = true;
}
}
}
if ((!mergingObject.GetProxyState(propertyValue.Key)) && (includePath))
{
if (propertyValue.Value != null)
{
Type propertyType = propertyValue.Value.GetType();
if (IsDataList(propertyType))
{
IDataList mergingList = ((IDataList)propertyValue.Value);
IDataList dataList = (IDataList)LightHouse.Elite.Core.Builder.Get(propertyValue.Value.GetType());
for (int i = 0; i < mergingList.Count; i++)
{
IDataObject cloningObject = (IDataObject)mergingList[i];
if (IsReferenceObject(cloningObject))
{
//Proxy on new generated object should be set to false, otherwise will bet unproxied on storing
if (String.IsNullOrEmpty(cloningObject.ID))
{
IDataObject referencedObject = GetProxyObject(cloningObject);
dataList.Add(referencedObject);
}
else
{
dataList.Add(GetReferencedObject(cloningObject));
}
}
else
{
IDataObject referencedObject = GetProxyObject(cloningObject);
dataList.Add(referencedObject);
}
}
baseObject.SetProperty(propertyValue.Key, dataList);
}
else if (IsDataObject(propertyType))
{
DataObject cloningObject = ((DataObject)propertyValue.Value);
if (IsReferenceObject(cloningObject))
{
// If the Object hasn't been saved, it is persisted as such to the database
if (String.IsNullOrEmpty(cloningObject.ID))
{
IDataObject referencedObject = GetProxyObject(cloningObject);
baseObject.SetProperty(propertyValue.Key, referencedObject);
}
else
{
baseObject.SetProperty(propertyValue.Key, GetReferencedObject(cloningObject));
}
}
else
{
IDataObject referencedObject = GetProxyObject(cloningObject);
baseObject.SetProperty(propertyValue.Key, referencedObject);
}
}
else
{
baseObject.SetProperty(propertyValue.Key, propertyValue.Value);
}
}
else
{
baseObject.SetProperty(propertyValue.Key, propertyValue.Value);
}
//.........这里部分代码省略.........