protected Mapping.Property CreateProperty(IValue value, string propertyName, System.Type parentClass,
			XmlNode subnode)
        {
            if (parentClass != null && value.IsSimpleValue)
                value.SetTypeUsingReflection(parentClass.AssemblyQualifiedName, propertyName, PropertyAccess(subnode));

            // This is done here 'cos we might only know the type here (ugly!)
            if (value is ToOne)
            {
                ToOne toOne = (ToOne) value;
                string propertyRef = toOne.ReferencedPropertyName;
                if (propertyRef != null)
                    mappings.AddUniquePropertyReference(toOne.ReferencedEntityName, propertyRef);
            }

            value.CreateForeignKey();
            Mapping.Property prop = new Mapping.Property();
            prop.Value = value;
            BindProperty(subnode, prop);

            return prop;
        }
		private static Mapping.Property CreateProperty( IValue value, string propertyName, System.Type parentClass, XmlNode subnode, Mappings mappings )
		{
			if( parentClass != null && value.IsSimpleValue )
			{
				( ( SimpleValue ) value ).SetTypeByReflection( parentClass, propertyName, PropertyAccess( subnode, mappings ) );
			}

			// This is done here 'cos we might only know the type here (ugly!)
			if( value is ToOne )
			{
				string propertyRef = ( ( ToOne ) value ).ReferencedPropertyName;
				if( propertyRef != null )
				{
					mappings.AddUniquePropertyReference( ( ( EntityType ) value.Type ).AssociatedClass, propertyRef );
				}
			}

			value.CreateForeignKey();
			Mapping.Property prop = new Mapping.Property();
			prop.Value = value;
			BindProperty( subnode, prop, mappings );

			return prop;
		}
Beispiel #3
0
		protected Property CreateProperty(IValue value, string propertyName, string className,
			XmlNode subnode, IDictionary<string, MetaAttribute> inheritedMetas)
		{
			if (string.IsNullOrEmpty(propertyName))
			{
				throw new MappingException(subnode.LocalName + " mapping must defined a name attribute [" + className + "]");
			}

			if (!string.IsNullOrEmpty(className) && value.IsSimpleValue)
				value.SetTypeUsingReflection(className, propertyName, PropertyAccess(subnode));

			// This is done here 'cos we might only know the type here (ugly!)
			var toOne = value as ToOne;
			if (toOne != null)
			{
				string propertyRef = toOne.ReferencedPropertyName;
				if (propertyRef != null)
					mappings.AddUniquePropertyReference(toOne.ReferencedEntityName, propertyRef);
			}

			value.CreateForeignKey();
			var prop = new Property {Value = value};
			BindProperty(subnode, prop, inheritedMetas);

			return prop;
		}