/// <summary> /// This class is responsible for getting the current iterate item object within an iteration. i.e. The property name starts with "[]." /// We do this by navigating up through the parent nodes to determine which of them are iterate elements. /// Once found we get the current iteration context item. /// If "[]." is not specified, the original approach is used of reflecting the parameterObject to the reflection path specified in the property /// </summary> /// <param name="ctx"></param> /// <param name="baseTag"></param> /// <param name="parameterObject"></param> /// <returns></returns> /// <remarks> /// Created By: Richard Beacroft /// Created Date: 11\10\2013 /// </remarks> protected object GetMemberPropertyValue(SqlTagContext ctx, BaseTag baseTag, object parameterObject) { if (String.IsNullOrEmpty(baseTag.Property)) { return(parameterObject); } #if dotnet35 var bindingReplacement = ctx.BuildPropertyBindingReplacements(baseTag).FirstOrDefault(); #else BindingReplacement bindingReplacement = null; foreach (var replacement in ctx.BuildPropertyBindingReplacements(baseTag)) { bindingReplacement = replacement; break; } #endif if (bindingReplacement != null) { if (String.IsNullOrEmpty(bindingReplacement.FullPropertyName)) { return(bindingReplacement.Value); } return(_tagPropertyProbe.GetMemberValue(ctx, baseTag, bindingReplacement.FullPropertyName, parameterObject)); } return(_tagPropertyProbe.GetMemberPropertyValue(ctx, baseTag, parameterObject)); }
/// <summary> /// This class is responsible for getting the current iterate item object within an iteration. i.e. The property name starts with "[]." /// We do this by navigating up through the parent nodes to determine which of them are iterate elements. /// Once found we get the current iteration context item. /// If "[]." is not specified, the original approach is used of reflecting the parameterObject to the reflection path specified in the property /// </summary> /// <param name="ctx"></param> /// <param name="baseTag"></param> /// <param name="parameterObject"></param> /// <returns></returns> /// <remarks> /// Created By: Richard Beacroft /// Created Date: 11\10\2013 /// </remarks> protected object GetMemberPropertyValue(SqlTagContext ctx, BaseTag baseTag, object parameterObject) { if (String.IsNullOrEmpty(baseTag.Property)) { return(parameterObject); } var bindingReplacement = ctx.BuildPropertyBindingReplacements(baseTag).FirstOrDefault(); if (bindingReplacement != null) { if (String.IsNullOrEmpty(bindingReplacement.FullPropertyName)) { return(bindingReplacement.Value); } return(_tagPropertyProbe.GetMemberValue(ctx, baseTag, bindingReplacement.FullPropertyName, parameterObject)); } return(_tagPropertyProbe.GetMemberPropertyValue(ctx, baseTag, parameterObject)); }
/// <summary> /// This class is responsible for getting the current iterate item object within an iteration. i.e. The property name starts with "[]." /// We do this by navigating up through the parent nodes to determine which of them are iterate elements. /// Once found we get the current iteration context item. /// If "[]." is not specified, the original approach is used of reflecting the parameterObject to the reflection path specified in the property /// </summary> /// <param name="ctx"></param> /// <param name="baseTag"></param> /// <param name="parameterObject"></param> /// <returns></returns> /// <remarks> /// Created By: Richard Beacroft /// Created Date: 11\10\2013 /// </remarks> protected object GetMemberPropertyValue(SqlTagContext ctx, BaseTag baseTag, object parameterObject) { if (String.IsNullOrEmpty(baseTag.Property)) return parameterObject; var bindingReplacement = ctx.BuildPropertyBindingReplacements(baseTag).FirstOrDefault(); if (bindingReplacement != null) { if (String.IsNullOrEmpty(bindingReplacement.FullPropertyName)) return bindingReplacement.Value; return _tagPropertyProbe.GetMemberValue(ctx, baseTag, bindingReplacement.FullPropertyName, parameterObject); } return _tagPropertyProbe.GetMemberPropertyValue(ctx, baseTag, parameterObject); }