ParameterSyntax(string name, MetaId metaId, DbParam param, string front, string back, bool displayValue)
 {
     Name = name;
     MetaId = metaId;
     _param = param;
     _front = front;
     _back = back;
     _displayValue = displayValue;
 }
        internal static bool IsExtension(this MethodInfo methodInfo)
        {
            var id = new MetaId(methodInfo);

            lock (_isExtension)
            {
                bool check;
                if (!_isExtension.TryGetValue(id, out check))
                {
                    check            = methodInfo.IsDefined(typeof(ExtensionAttribute), false);
                    _isExtension[id] = check;
                }
                return(check);
            }
        }
        static T GetMemberConverter <T>(MemberInfo member, Dictionary <MetaId, T> cache) where T : Attribute
        {
            var id = new MetaId(member);

            lock (cache)
            {
                T attr;
                if (cache.TryGetValue(id, out attr))
                {
                    return(attr);
                }

                attr = member.GetAttribute <T>();
                cache.Add(id, attr);
                return(attr);
            }
        }
        internal string Push(object obj, string nameSrc = null, MetaId metadataToken = null, IDbParam param = null)
        {
            if (string.IsNullOrEmpty(nameSrc)) nameSrc = "p_" + _count++;
            else nameSrc = nameSrc.Replace(".", "_");

            var name = _prefix + nameSrc;

            DecodingParameterInfo val;
            if (_parameters.TryGetValue(name, out val))
            {
                //find same metatoken object.
                if (metadataToken != null && metadataToken == val.MetadataToken) return name;

                //make unique name.
                name = MakeUniqueName(nameSrc);
            }

            //register.
            if (param == null) param = new DbParamValueOnly() { Value = obj };
            _parameters.Add(name, new DecodingParameterInfo() { MetadataToken = metadataToken, Detail = param });

            return name;
        }
 internal ParameterSyntax(string name = null, MetaId metaId = null, DbParam param = null)
 {
     Name = name;
     MetaId = metaId;
     _param = param;
 }
 internal ParameterSyntax(object value)
 {
     Name = null;
     MetaId = null;
     _param = new DbParam() {Value = value };
 }