packages/System.Linq.Dynamic.Core.1.0.7.13/src/System.Linq.Dynamic.Core/GlobalConfig.cs

(开头部分) 2KB

这里只显示每个文件的开头 60 行。登录后可以解锁完整代码。

using System.Linq.Dynamic.Core.CustomTypeProviders;

namespace System.Linq.Dynamic.Core
{
    /// <summary>
    /// Static configuration class for Dynamic Linq.
    /// </summary>
    public static class GlobalConfig
    {
        private static IDynamicLinkCustomTypeProvider _customTypeProvider;

        /// <summary>
        /// Gets or sets the <see cref="IDynamicLinkCustomTypeProvider"/>.
        /// </summary>
        public static IDynamicLinkCustomTypeProvider CustomTypeProvider
        {
            get
            {
#if !(DOTNET5_1 || WINDOWS_APP || UAP10_0 || NETSTANDARD)
                // only use DefaultDynamicLinqCustomTypeProvider if not WINDOWS_APP || UAP10_0 || NETSTANDARD
                return _customTypeProvider ?? (_customTypeProvider = new DefaultDynamicLinqCustomTypeProvider());
#else
                return _customTypeProvider;
#endif
            }

            set
            {
                if (_customTypeProvider != value)
                {
                    _customTypeProvider = value;

                    ExpressionParser.ResetDynamicLinqTypes();
                }
            }
        }

        static bool _contextKeywordsEnabled = true;

        /// <summary>
        /// Determines if the context keywords (it, parent, and root) are valid and usable inside a Dynamic Linq string expression.  
        /// Does not affect the usability of the equivalent context symbols ($, ^ and ~).
        /// </summary>
        public static bool AreContextKeywordsEnabled
        {
            get => _contextKeywordsEnabled;
            set
            {
                if (value != _contextKeywordsEnabled)
                {
                    _contextKeywordsEnabled = value;

                    ExpressionParser.ResetDynamicLinqTypes();
                }
            }
        }

        /// <summary>
        /// Gets or sets a value indicating whether to use dynamic object class for anonymous types.
        /// </summary>
后面还有 6 行代码,解锁后查看完整代码

24 小时内免费解锁 3 个项目,之后 1 积分/个。 规则说明

AI 解读

登录后可用,每次 10 积分,解读结果公开显示在下面。

还没有人解读过这个文件。