internal XmlEntityTypeBuilder(XmlEntityTypeInfo xmlEntityTypeInfo, XmlModelTypeInfo xmlModelTypeInfo, XmlDataModel xmlModelTypeBuilder)
 {
     _xmlEntityTypeInfo   = xmlEntityTypeInfo;
     _xmlModelTypeInfo    = xmlModelTypeInfo;
     _xmlModelTypeBuilder = xmlModelTypeBuilder;
     _xmlModelTypeBuilder.XmlModelInfo.SerializationTypesKeyedByName[_entityType.Name] = _entityType;
 }
Beispiel #2
0
 public XmlEntityTypeInfo GetOrCreateTypeInfo(Type entityType)
 {
     if (!EntitiesInfoKeyedByType.TryGetValue(entityType, out XmlEntityTypeInfo xmlEntityTypeInfo))
     {
         xmlEntityTypeInfo            = new XmlEntityTypeInfo();
         xmlEntityTypeInfo.EntityType = entityType;
         EntitiesInfoKeyedByType.Add(entityType, xmlEntityTypeInfo);
     }
     return(xmlEntityTypeInfo);
 }
        public XmlEntityTypeInfo Copy()
        {
            XmlEntityTypeInfo xmlEntityTypeInfo = new XmlEntityTypeInfo();

            xmlEntityTypeInfo.EntityType = EntityType;
            xmlEntityTypeInfo.XmlName    = XmlName;
            xmlEntityTypeInfo.SerializeAsXmlAttribute = SerializeAsXmlAttribute;

            foreach (var propertyTypeInfoByName in PropertiesTypeInfo)
            {
                xmlEntityTypeInfo.PropertiesTypeInfo.Add(propertyTypeInfoByName.Key, propertyTypeInfoByName.Value.Copy());
            }

            foreach (var constructorParameterTypeInfoByPosition in ConstructorParametersTypeInfo)
            {
                xmlEntityTypeInfo.ConstructorParametersTypeInfo.Add(constructorParameterTypeInfoByPosition.Key, constructorParameterTypeInfoByPosition.Value.Copy());
            }
            return(xmlEntityTypeInfo);
        }
Beispiel #4
0
        /// <summary>
        /// Specify that an entity type belongs to the XML model.
        /// If the entity type is not already part of the model, it will be added to it.
        /// </summary>
        /// <typeparam name="TEntity">The entity type that belongs to XML model.</typeparam>
        /// <returns>An object that can be used to configure the entity type.</returns>
        public XmlEntityTypeBuilder <TEntity> HasKnownEntity <TEntity>()
        {
            XmlEntityTypeInfo xmlEntityTypeInfo = XmlModelInfo.GetOrCreateTypeInfo(typeof(TEntity));

            return(new XmlEntityTypeBuilder <TEntity>(xmlEntityTypeInfo, XmlModelInfo, this));
        }
Beispiel #5
0
        public XmlConstructorParameterTypeInfo GetOrCreateConstructorArgumentTypeInfo(Type entityType, int constructorParameterIndex)
        {
            XmlEntityTypeInfo xmlEntityTypeInfo = GetOrCreateTypeInfo(entityType);

            return(xmlEntityTypeInfo.GetOrCreateConstructorParameterTypeInfo(constructorParameterIndex));
        }
Beispiel #6
0
        public XmlPropertyTypeInfo GetOrCreatePropertyTypeInfo(Type entityType, string propertyName, PropertyInfo propertyInfo)
        {
            XmlEntityTypeInfo xmlEntityTypeInfo = GetOrCreateTypeInfo(entityType);

            return(xmlEntityTypeInfo.GetOrCreatePropertyTypeInfo(propertyName, propertyInfo));
        }