Exemplo n.º 1
0
        internal static Property Create <TY>(Expression <Func <TY, T> > property)
        {
            var eventFieldMemberExpression = new EventFieldMemberExpression(property.Body as MemberExpression);

            if (BuiltIn.All().Contains(eventFieldMemberExpression.UnescapedEventFieldName))
            {
                return(Property.BuiltIn(eventFieldMemberExpression.UnescapedEventFieldName));
            }
            return(Property.Custom(eventFieldMemberExpression.UnescapedEventFieldName, eventFieldMemberExpression.EventFieldDataType));
        }
        private string UnescapeEventFieldName(string eventFieldName)
        {
            if (BuiltIn.All().Contains(eventFieldName))
            {
                return(eventFieldName);
            }

            if (eventFieldName.StartsWith("[") && eventFieldName.EndsWith("]"))
            {
                return(eventFieldName.Substring(1, EscapedEventFieldName.Length - 2));
            }

            return(eventFieldName);
        }
        private string EscapeEventFieldName(string eventFieldName)
        {
            if (BuiltIn.All().Contains(eventFieldName))
            {
                return(eventFieldName);
            }

            if (eventFieldName.StartsWith("[") && eventFieldName.EndsWith("]"))
            {
                return(eventFieldName);
            }

            return($"[{eventFieldName}]");
        }