[ResourceConsumption(ResourceScope.Assembly | ResourceScope.Machine, ResourceScope.Assembly | ResourceScope.Machine)] // FindType method call. private void InitStaticTables() { this.InitStaticTableTypes(); foreach (TableMapping tableMapping in this.mapping.Tables) { Type rowType = this.FindType(tableMapping.RowType.Name); if (rowType == null) { throw Error.CouldNotFindTypeFromMapping(tableMapping.RowType.Name); } Type rootType = this.GetRootType(rowType, tableMapping.RowType); MetaTable table = new MappedTable(this, tableMapping, rootType); foreach (MetaType mt in table.RowType.InheritanceTypes) { this.metaTypes.Add(mt.Type, mt); this.metaTables.Add(mt.Type, table); } } }
[ResourceConsumption(ResourceScope.Assembly | ResourceScope.Machine)] // InitInheritedType method call. public MappedRootType(MappedMetaModel model, MappedTable table, TypeMapping typeMapping, Type type) : base(model, table, typeMapping, type, null) { if (typeMapping == null) { throw Error.ArgumentNull("typeMapping"); } if (typeMapping.InheritanceCode != null || typeMapping.DerivedTypes.Count > 0) { if (this.Discriminator == null) { throw Error.NoDiscriminatorFound(type.Name); } this.hasInheritance = true; if (!MappingSystem.IsSupportedDiscriminatorType(this.Discriminator.Type)) { throw Error.DiscriminatorClrTypeNotSupported(this.Discriminator.DeclaringType.Name, this.Discriminator.Name, this.Discriminator.Type); } this.derivedTypes = new Dictionary <Type, MetaType>(); this.inheritanceCodes = new Dictionary <object, MetaType>(); this.InitInheritedType(typeMapping, this); } if (this.inheritanceDefault == null && (this.InheritanceCode != null || this.inheritanceCodes != null && this.inheritanceCodes.Count > 0)) { throw Error.InheritanceHierarchyDoesNotDefineDefault(type); } if (this.derivedTypes != null) { this.inheritanceTypes = this.derivedTypes.Values.ToList().AsReadOnly(); } else { this.inheritanceTypes = new MetaType[] { this }.ToList().AsReadOnly(); } this.Validate(); }
[ResourceConsumption(ResourceScope.Assembly | ResourceScope.Machine)] // InitInheritedType method call. public MappedRootType(MappedMetaModel model, MappedTable table, TypeMapping typeMapping, Type type) : base(model, table, typeMapping, type, null) { if(typeMapping == null) throw Error.ArgumentNull("typeMapping"); if(typeMapping.InheritanceCode != null || typeMapping.DerivedTypes.Count > 0) { if(this.Discriminator == null) { throw Error.NoDiscriminatorFound(type.Name); } this.hasInheritance = true; if(!MappingSystem.IsSupportedDiscriminatorType(this.Discriminator.Type)) { throw Error.DiscriminatorClrTypeNotSupported(this.Discriminator.DeclaringType.Name, this.Discriminator.Name, this.Discriminator.Type); } this.derivedTypes = new Dictionary<Type, MetaType>(); this.inheritanceCodes = new Dictionary<object, MetaType>(); this.InitInheritedType(typeMapping, this); } if(this.inheritanceDefault == null && (this.InheritanceCode != null || this.inheritanceCodes != null && this.inheritanceCodes.Count > 0)) throw Error.InheritanceHierarchyDoesNotDefineDefault(type); if(this.derivedTypes != null) { this.inheritanceTypes = this.derivedTypes.Values.ToList().AsReadOnly(); } else { this.inheritanceTypes = new MetaType[] { this }.ToList().AsReadOnly(); } this.Validate(); }