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; }
private void CreateEmptyGreenObject() { Interlocked.Exchange(ref this.emptyGreenObject, GreenObject.CreateWithSlots(this.Slots)); }