public string PropertyName(PropertyNameMarker marker) { if (marker.IsConditionless()) { return(null); } return(!marker.Name.IsNullOrEmpty() ? marker.Name : marker.Expression != null ? this.PropertyNameResolver.ResolveToLastToken(marker.Expression) : this.TypeName(marker.Type)); }
public void PropertyNameMarkerEqualsDoesNotUseHashCode() { var collision = GetHashCollison(); var propertyMarker1 = new PropertyNameMarker { Name = collision.Item1 }; var propertyMarker2 = new PropertyNameMarker { Name = collision.Item2 }; this.TestAddingToDictionary(propertyMarker1, propertyMarker2); }
/// <summary> /// Create a strongly typed string representation of the name to a property /// <para>i.e p => p.Arrary.First().SubProperty.Field will return 'field'</para> /// </summary> /// <typeparam name="T">The type of the object</typeparam> /// <param name="path">The path we want to specify</param> /// <param name="boost">An optional ^boost postfix, only make sense with queries</param> public static PropertyNameMarker Name <T>(Expression <Func <T, object> > path, double?boost = null) where T : class { return(PropertyNameMarker.Create(path, boost)); }