AdvantageCMS.Core.Admin.BaseClasses Namespace
AdvantageCMS.Core.Common.BaseClasses Namespace
Build With Advantage

BusinessObjectBase..::..GetPropertyNameCore Method

Resolves the property name from a property-reference expression, supporting both direct member access and value-type-conversion wrappers. This is the underlying worker used by [GetPropertyName{TObject}(Expression{Func{TObject, object}})]; derived classes can call it directly when working with an already-built Expression tree.

Namespace:  AdvantageCMS.Core.Admin.BaseClasses
Assembly:  AdvantageCMS.Core (in AdvantageCMS.Core.dll)

Syntax


protected static string GetPropertyNameCore(
	Expression propertyRefExpr
)

Parameters

propertyRefExpr
Type: Expression
The expression body to inspect — typically a MemberExpression, or a UnaryExpression wrapping one for value-typed properties.

Return Value

The property's name as a string.

Exceptions


ExceptionCondition
ArgumentNullExceptionpropertyRefExpr is null.
ArgumentExceptionNo property reference expression was found in propertyRefExpr.

Examples


C#
// Typically called via GetPropertyName, but can be invoked directly with a raw Expression body:
Expression<Func<AgentConfig, object>> expr = p => p.Name;
string propName = GetPropertyNameCore(expr.Body);
// propName == "Name"

// Value-typed property — the Expression body is a UnaryExpression (Convert) that
// GetPropertyNameCore unwraps automatically:
Expression<Func<AgentConfig, object>> verExpr = p => p.Version;
string verProp = GetPropertyNameCore(verExpr.Body);
// verProp == "Version"