本文整理汇总了C#中IContext.GetPropertyStatus方法的典型用法代码示例。如果您正苦于以下问题:C# IContext.GetPropertyStatus方法的具体用法?C# IContext.GetPropertyStatus怎么用?C# IContext.GetPropertyStatus使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类IContext
的用法示例。
在下文中一共展示了IContext.GetPropertyStatus方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: SetupTableColumns
private void SetupTableColumns(object obj, DataTable table, IClassMap classMap, IContext context, string prefix)
{
object refObj;
foreach (IPropertyMap propertyMap in classMap.GetAllPropertyMaps())
{
if (context.GetPropertyStatus(obj, propertyMap.Name) == PropertyStatus.NotLoaded)
{
}
else
{
if (!(propertyMap.IsCollection))
{
if (propertyMap.ReferenceType != ReferenceType.None)
{
}
else
{
if (!(table.Columns.Contains(prefix + propertyMap.Name)))
{
table.Columns.Add(prefix + propertyMap.Name, obj.GetType().GetProperty(propertyMap.Name).PropertyType );
}
}
}
}
}
foreach (IPropertyMap propertyMap in classMap.GetAllPropertyMaps())
{
if (context.GetPropertyStatus(obj, propertyMap.Name) == PropertyStatus.NotLoaded)
{
}
else
{
if (!(propertyMap.IsCollection))
{
if (propertyMap.ReferenceType != ReferenceType.None)
{
refObj = context.ObjectManager.GetPropertyValue(obj, propertyMap.Name);
if (refObj == null)
{
}
else
{
SetupTableColumns(refObj,
table, propertyMap.GetReferencedClassMap(),
context,
prefix + propertyMap.Name + ".");
}
}
else
{
}
}
}
}
}
示例2: AddObjectToTable
private void AddObjectToTable(object obj, DataTable table, IClassMap classMap, IContext context, string prefix, DataRow dr)
{
object refObj;
foreach (IPropertyMap propertyMap in classMap.GetAllPropertyMaps())
{
if (!(propertyMap.IsCollection))
{
if (context.GetPropertyStatus(obj, propertyMap.Name) != PropertyStatus.NotLoaded)
{
if (propertyMap.ReferenceType != ReferenceType.None)
{
}
else
{
if (table.Columns.Contains(prefix + propertyMap.Name))
{
if (obj.GetType().GetProperty(propertyMap.Name).GetValue(obj, null) == null)
{
dr[prefix + propertyMap.Name] = System.DBNull.Value;
}
else
{
dr[prefix + propertyMap.Name] = obj.GetType().GetProperty(propertyMap.Name).GetValue(obj, null);
}
}
}
}
}
}
foreach (IPropertyMap propertyMap in classMap.GetAllPropertyMaps())
{
if (!(propertyMap.IsCollection))
{
if (context.GetPropertyStatus(obj, propertyMap.Name) != PropertyStatus.NotLoaded)
{
if (propertyMap.ReferenceType != ReferenceType.None)
{
refObj = obj.GetType().GetProperty(propertyMap.Name).GetValue(obj, null);
if (refObj == null)
{
if (table.Columns.Contains(prefix + propertyMap.Name))
{
dr[prefix + propertyMap.Name] = System.DBNull.Value;
}
}
else
{
AddObjectToTable(refObj,
table,
context.DomainMap.MustGetClassMap(refObj.GetType()),
context,
prefix + propertyMap.Name + ".",
dr);
}
}
else
{
}
}
}
}
if (prefix == "")
{
table.Rows.Add(dr);
}
}