public override Expression VisitElement(XElement element, IInitializationContext context) { var nameAttribute = element .Attributes(NameAttributeName) .Select(attr => attr.Value) .FirstOrDefault(); if (nameAttribute == null) { throw new ConfirurationFileFormatException("Alias element must have name attribute"); } if (element.HasElements) { throw new ConfirurationFileFormatException("Alias element shoudn't have child elements"); } return(context.GetAlias(nameAttribute)); }