[ResourceConsumption(ResourceScope.Assembly | ResourceScope.Machine, ResourceScope.Assembly | ResourceScope.Machine)] // For GetMethods call.
        private void InitFunctions()
        {
            this.metaFunctions = new Dictionary <MetaPosition, MetaFunction>();
            if (this.contextType != typeof(DataContext))
            {
                foreach (FunctionMapping fmap in this.mapping.Functions)
                {
                    MethodInfo method = this.GetMethod(fmap.MethodName);
                    if (method == null)
                    {
                        throw Error.MethodCannotBeFound(fmap.MethodName);
                    }
                    MappedFunction func = new MappedFunction(this, fmap, method);
                    this.metaFunctions.Add(new MetaPosition(method), func);

                    // pre-set all known function result types into metaType map
                    foreach (MetaType rt in func.ResultRowTypes)
                    {
                        foreach (MetaType it in rt.InheritanceTypes)
                        {
                            if (!this.metaTypes.ContainsKey(it.Type))
                            {
                                this.metaTypes.Add(it.Type, it);
                            }
                        }
                    }
                }
            }
        }
        [ResourceConsumption(ResourceScope.Assembly | ResourceScope.Machine, ResourceScope.Assembly | ResourceScope.Machine)] // For GetMethods call.
        private void InitFunctions() {
            this.metaFunctions = new Dictionary<MetaPosition, MetaFunction>();
            if (this.contextType != typeof(DataContext)) {
                foreach (FunctionMapping fmap in this.mapping.Functions) {
                    MethodInfo method = this.GetMethod(fmap.MethodName);
                    if (method == null) {
                        throw Error.MethodCannotBeFound(fmap.MethodName);
                    }
                    MappedFunction func = new MappedFunction(this, fmap, method);
                    this.metaFunctions.Add(new MetaPosition(method), func);

                    // pre-set all known function result types into metaType map
                    foreach (MetaType rt in func.ResultRowTypes) {
                        foreach (MetaType it in rt.InheritanceTypes) {
                            if (!this.metaTypes.ContainsKey(it.Type)) {
                                this.metaTypes.Add(it.Type, it);
                            }
                        }
                    }
                }
            }
        }