Ejemplo n.º 1
0
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public virtual IReadOnlyDictionary <string, PropertyInfo> GetRuntimeProperties()
        {
            if (ClrType == null)
            {
                return(null);
            }

            if (_runtimeProperties == null)
            {
                var runtimeProperties = new Dictionary <string, PropertyInfo>(StringComparer.Ordinal);
                foreach (var property in ClrType.GetRuntimeProperties())
                {
                    if (!property.IsStatic() &&
                        !runtimeProperties.ContainsKey(property.Name))
                    {
                        runtimeProperties[property.Name] = property;
                    }
                }

                // _runtimeProperties should not be mutated after it has been assigned
                Thread.MemoryBarrier();
                _runtimeProperties = runtimeProperties;
            }

            return(_runtimeProperties);
        }
Ejemplo n.º 2
0
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public virtual Dictionary <string, PropertyInfo> GetRuntimeProperties()
        {
            if (ClrType == null)
            {
                return(null);
            }

            if (_runtimeProperties == null)
            {
                _runtimeProperties = new Dictionary <string, PropertyInfo>();
                foreach (var property in ClrType.GetRuntimeProperties())
                {
                    if (!property.IsStatic() &&
                        !_runtimeProperties.ContainsKey(property.Name))
                    {
                        _runtimeProperties[property.Name] = property;
                    }
                }
            }

            return(_runtimeProperties);
        }
Ejemplo n.º 3
0
        /// <summary>
        ///     This API supports the Entity Framework Core infrastructure and is not intended to be used
        ///     directly from your code. This API may change or be removed in future releases.
        /// </summary>
        public virtual IReadOnlyDictionary <string, PropertyInfo> GetRuntimeProperties()
        {
            if (ClrType == null)
            {
                return(null);
            }

            if (_runtimeProperties == null)
            {
                var runtimeProperties = new Dictionary <string, PropertyInfo>(StringComparer.Ordinal);
                foreach (var property in ClrType.GetRuntimeProperties())
                {
                    if (!property.IsStatic() &&
                        !runtimeProperties.ContainsKey(property.Name))
                    {
                        runtimeProperties[property.Name] = property;
                    }
                }

                Interlocked.CompareExchange(ref _runtimeProperties, runtimeProperties, null);
            }

            return(_runtimeProperties);
        }