コード例 #1
0
        //_list_condition_func
        PreSelectBuilderFunc GetPreSelectBuilderFunc(System.Type type, string value)
        {
            PreSelectBuilderFunc func;
            string key = type.AssemblyQualifiedName + "|" + value;

            if (!_list_condition_func.TryGetValue(key, out func))
            {
                ThreadHelper.Block(_list_condition_func, () => {
                    if (!_list_condition_func.TryGetValue(value, out func))
                    {
                        if (value.StartsWith("$this.", StringComparison.OrdinalIgnoreCase))
                        {
                            string path = value.Substring("$this.".Length);
                            func        = (dataContext, dataReader, entity) => {
                                return(FastObject.Path(entity, path));
                            };
                        }
                        if (value.StartsWith("$reader.", StringComparison.OrdinalIgnoreCase))
                        {
                            string p10 = value.Substring("$reader.".Length);
                            if (p10.IndexOf('.') > -1)
                            {
                                string name = p10.Split('.')[0];
                                string path = p10.Substring(name.Length + 1);
                                func        = (dataContext, dataReader, entity) => {
                                    return(FastObject.Path(DataReaderHelper.Current(dataReader, name), path));
                                };
                            }
                            else
                            {
                                func = (dataContext, dataReader, entity) => {
                                    return(DataReaderHelper.Current(dataReader, p10));
                                };
                            }
                        }
                        _list_condition_func.TryAdd(key, func);
                    }
                });
            }
            return(func);
        }