/// <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, FieldInfo> GetRuntimeFields() { if (ClrType == null) { return(null); } if (_runtimeFields == null) { var runtimeFields = new Dictionary <string, FieldInfo>(StringComparer.Ordinal); foreach (var field in ClrType.GetRuntimeFields()) { if (!field.IsStatic && !runtimeFields.ContainsKey(field.Name)) { runtimeFields[field.Name] = field; } } // _runtimeFields should not be mutated after it has been assigned Thread.MemoryBarrier(); _runtimeFields = runtimeFields; } return(_runtimeFields); }
/// <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, FieldInfo> GetRuntimeFields() { if (ClrType == null) { return(null); } if (_runtimeFields == null) { _runtimeFields = new Dictionary <string, FieldInfo>(); foreach (var field in ClrType.GetRuntimeFields()) { if (!field.IsStatic && !_runtimeFields.ContainsKey(field.Name)) { _runtimeFields[field.Name] = field; } } } return(_runtimeFields); }
/// <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, FieldInfo> GetRuntimeFields() { if (ClrType == null) { return(null); } if (_runtimeFields == null) { var runtimeFields = new Dictionary <string, FieldInfo>(StringComparer.Ordinal); foreach (var field in ClrType.GetRuntimeFields()) { if (!field.IsStatic && !runtimeFields.ContainsKey(field.Name)) { runtimeFields[field.Name] = field; } } Interlocked.CompareExchange(ref _runtimeFields, runtimeFields, null); } return(_runtimeFields); }