Beispiel #1
0
        public EffectiveAnnotations Read()
        {
            var annotations = itrlck.Get(location: ref _annotations);

            if (annotations is null)
            {
                ValueHolderClass <EffectiveAnnotations> newAnnotations;
                try {
                    newAnnotations = new ValueHolderClass <EffectiveAnnotations>(value: readNew());
                }
                catch (Exception exception) {
                    newAnnotations = new ValueHolderClass <EffectiveAnnotations>(exception: exception);
                }
                annotations = itrlck.UpdateIfNull(location: ref _annotations, value: newAnnotations);
            }
            return(annotations.Value);

            //
            EffectiveAnnotations readNew()
            {
                var locAnnotatedType          = AnnotatedType;
                var effectiveAnnotationsArray = P_GetEffectiveAnnotations(annotatedType: locAnnotatedType);

                for (var i = 0; i < effectiveAnnotationsArray.Length; i++)
                {
                    effectiveAnnotationsArray[i].ValidateApplicationWith(otherEffectiveAnnotations: effectiveAnnotationsArray.Where(y => !ReferenceEquals(y, effectiveAnnotationsArray[i])));
                }
                return(new EffectiveAnnotations(effectiveAnnotationsArray));
            }
        }
Beispiel #2
0
 protected override void Dispose(bool explicitDispose)
 {
     if (explicitDispose)
     {
         _dataContextPool?.Dispose();
         _referenceKeyProvider?.Dispose();
     }
     _dataContextPool              = null;
     _dataContextPoolingSettings   = null;
     _efDbContextOptions           = null;
     _referenceKeyProviderSettings = null;
     _referenceKeyProvider         = null;
     _serviceProvider              = null;
     //
     base.Dispose(explicitDispose);
 }