private void BindSimpleValue(HbmDiscriminator discriminatorSchema, SimpleValue discriminator)
		{
			if (discriminatorSchema.type != null)
				discriminator.TypeName = discriminatorSchema.type;

			if (discriminatorSchema.formula != null)
			{
				var f = new Formula {FormulaString = discriminatorSchema.formula};
				discriminator.AddFormula(f);
			}
			else
			{
				new ColumnsBinder(discriminator, Mappings).Bind(discriminatorSchema.Columns, false,
				                                                () =>
				                                                new HbmColumn
				                                                	{
				                                                		name =
				                                                			mappings.NamingStrategy.PropertyToColumnName(
				                                                			RootClass.DefaultDiscriminatorColumnName),
				                                                		length = discriminatorSchema.length,
																														notnull = discriminatorSchema.notnull,
																														notnullSpecified = true
				                                                	});
			}
		}
		private void BindSimpleValue(HbmDiscriminator discriminatorSchema, SimpleValue discriminator)
		{
			if (discriminatorSchema.type != null)
				discriminator.TypeName = discriminatorSchema.type;

			if (discriminatorSchema.formula != null)
			{
				Formula f = new Formula();
				f.FormulaString = discriminatorSchema.formula;
				discriminator.AddFormula(f);
			}
			else
				BindColumns(discriminatorSchema, discriminator);
		}
Example #3
0
		public virtual void AddFormula(Formula formula)
		{
			columns.Add(formula);
		}
		//automatically makes a column with the default name if none is specifed by XML
		public static void BindSimpleValue( XmlNode node, SimpleValue model, bool isNullable, string path, Mappings mappings )
		{
			model.Type = GetTypeFromXML( node );

			XmlAttribute formulaNode = node.Attributes[ "formula" ];
			if( formulaNode != null )
			{
				Formula f = new Formula();
				f.FormulaString = formulaNode.InnerText;
				model.Formula = f;
			}
			else
			{
				BindColumns( node, model, isNullable, true, path, mappings );
			}

			XmlAttribute fkNode = node.Attributes[ "foreign-key" ];
			if( fkNode != null )
			{
				model.ForeignKeyName = fkNode.Value;
			}
		}
 private void BindColumnsOrFormula(XmlNode node, SimpleValue simpleValue, string path, bool isNullable)
 {
     XmlAttribute formulaNode = node.Attributes["formula"];
     if (formulaNode != null)
     {
         Formula f = new Formula();
         f.FormulaString = formulaNode.InnerText;
         simpleValue.AddFormula(f);
     }
     else
         BindColumns(node, simpleValue, isNullable, true, path);
 }
 public void Bind()
 {
     if (!string.IsNullOrEmpty(formulaString))
     {
         log.DebugFormat("binding formula {0}", formulaString);
         formula = new Formula();
         formula.FormulaString = formulaString;
     }
     else
     {
         InitMappingColumn(logicalColumnName, propertyName, length, precision, scale, nullable, sqlType, unique,
                           true);
         log.DebugFormat("Binding column {0}. Unique {1}", mappingColumn.Name, unique);
     }
 }
Example #7
0
 public static void AddFormula(XmlElement element, Formula formula)
 {
     element.SetAttribute("formula", formula.Text);
 }
Example #8
0
		private void BindColumnsOrFormula(XmlNode node, SimpleValue simpleValue, string path, bool isNullable)
		{
			var formula = GetFormula(node);
			if (formula != null)
			{
				var f = new Formula { FormulaString = formula };
				simpleValue.AddFormula(f);
			}
			else
				BindColumns(node, simpleValue, isNullable, true, path);
		}
Example #9
0
 public virtual void AddFormula(Formula formula)
 {
     columns.Add(formula);
 }