private void InitializeBaseDescriptors()
 {
     if (this.initializedBaseDescriptors)
     {
         return;
     }
     lock (this)
     {
         if (this.initializedBaseDescriptors)
         {
             return;
         }
         foreach (var annot in this.annotations)
         {
             if (annot is ModelObjectDescriptorAttribute)
             {
                 ModelObjectDescriptorAttribute descrAnnot = (ModelObjectDescriptorAttribute)annot;
                 foreach (var baseType in descrAnnot.BaseDescriptors)
                 {
                     this.AddBaseDescriptor(ModelObjectDescriptor.GetDescriptorForDescriptorType(baseType));
                 }
             }
         }
         this.initializedBaseDescriptors = true;
     }
 }
 private ModelObjectDescriptor(Type descriptorType)
 {
     this.initialized = false;
     this.initializedBaseDescriptors = false;
     this.descriptorType             = descriptorType;
     this.annotations = descriptorType.GetCustomAttributes(false).OfType <Attribute>().ToImmutableArray();
     this.metaFlags   = MetaModelObjectFlags.None;
     foreach (var annot in this.annotations)
     {
         if (annot is ModelObjectDescriptorAttribute)
         {
             ModelObjectDescriptorAttribute da = (ModelObjectDescriptorAttribute)annot;
             this.idType        = da.IdType;
             this.immutableType = da.ImmutableType;
             this.mutableType   = da.MutableType;
         }
         else if (annot is LocalAttribute)
         {
             this.metaFlags |= MetaModelObjectFlags.Local;
         }
         else if (annot is ScopeAttribute)
         {
             this.metaFlags |= MetaModelObjectFlags.Scope;
         }
         else if (annot is LocalScopeAttribute)
         {
             this.metaFlags |= MetaModelObjectFlags.LocalScope;
         }
         else if (annot is TypeAttribute)
         {
             this.metaFlags |= MetaModelObjectFlags.Type;
         }
     }
     this.nameProperty       = null;
     this.typeProperty       = null;
     this.emptyGreenObject   = GreenObject.Empty;
     this.baseDescriptors    = ImmutableArray <ModelObjectDescriptor> .Empty;
     this.declaredProperties = ImmutableArray <ModelProperty> .Empty;
     this.slotMap            = ImmutableDictionary <ModelProperty, Slot> .Empty;
     this.slots         = ImmutableArray <Slot> .Empty;
     this.allProperties = ImmutableArray <ModelProperty> .Empty;
 }