本文整理汇总了C#中Castle.Components.Binder.CompositeNode.FullNameWithoutIndexer方法的典型用法代码示例。如果您正苦于以下问题:C# CompositeNode.FullNameWithoutIndexer方法的具体用法?C# CompositeNode.FullNameWithoutIndexer怎么用?C# CompositeNode.FullNameWithoutIndexer使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Castle.Components.Binder.CompositeNode
的用法示例。
在下文中一共展示了CompositeNode.FullNameWithoutIndexer方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的C#代码示例。
示例1: InternalRecursiveBindObjectInstance
protected void InternalRecursiveBindObjectInstance(object instance, String prefix, CompositeNode node)
{
if (node == null || instance == null)
{
return;
}
BeforeBinding(instance, prefix, node);
if (PerformCustomBinding(instance, prefix, node))
{
return;
}
PushInstance(instance, prefix);
var summary = new ErrorSummary();
validationErrorSummaryPerInstance[instance] = summary;
Type instanceType = instance.GetType();
PropertyInfo[] props = instanceType.GetProperties(PropertiesBindingFlags);
var nodeFullName = node.FullNameWithoutIndexer();
foreach (PropertyInfo prop in props)
{
if (ShouldIgnoreProperty(prop, nodeFullName))
{
continue;
}
Type propType = prop.PropertyType;
String paramName = prop.Name;
String translatedParamName = Translate(instanceType, paramName);
if (translatedParamName == null)
{
continue;
}
bool isSimpleProperty = IsSimpleProperty(propType);
BeforeBindingProperty(instance, prop, prefix, node);
try
{
bool conversionSucceeded;
if (isSimpleProperty)
{
object value = ConvertToSimpleValue(propType, translatedParamName, node, out conversionSucceeded);
if (conversionSucceeded)
{
SetPropertyValue(instance, prop, value);
}
}
else
{
// if the property is an object, we look if it is already instantiated
Node nestedNode = node.GetChildNode(paramName);
if (nestedNode != null)
{
object value = prop.GetValue(instance, null);
if (ShouldRecreateInstance(value, propType, paramName, nestedNode))
{
value = InternalBindObject(propType, paramName, nestedNode, out conversionSucceeded);
if (conversionSucceeded)
{
SetPropertyValue(instance, prop, value);
}
}
else
{
InternalRecursiveBindObjectInstance(value, paramName, nestedNode);
}
}
}
}
catch (Exception ex)
{
errors.Add(new DataBindError(prefix, prop.Name, ex));
}
}
CheckForValidationFailures(instance, prefix, summary);
PopInstance(instance, prefix);
AfterBinding(instance, prefix, node);
}