Ejemplo n.º 1
0
        public static Ejb3Column[] BuildColumnFromAnnotation(
            ColumnAttribute[] anns,
            FormulaAttribute formulaAnn, Nullability nullability, IPropertyHolder propertyHolder,
            IPropertyData inferredData,
            IDictionary <string, Join> secondaryTables,
            ExtendedMappings mappings)
        {
            Ejb3Column[] columns;

            if (formulaAnn != null)
            {
                Ejb3Column formulaColumn = new Ejb3Column();
                formulaColumn.SetFormula(formulaAnn.Value);
                formulaColumn.SetImplicit(false);
                formulaColumn.Mappings       = mappings;
                formulaColumn.PropertyHolder = propertyHolder;
                formulaColumn.Bind();
                columns = new Ejb3Column[] { formulaColumn };
            }
            else
            {
                columns = BuildColumnFromAnnotation(anns,
                                                    nullability,
                                                    propertyHolder,
                                                    inferredData,
                                                    secondaryTables,
                                                    mappings);
            }
            return(columns);
        }
Ejemplo n.º 2
0
        public FormulaColumn(FormulaAttribute formulaAttribute, EntityTable table)
            : base(table, formulaAttribute.Alias)
        {
            FormulaAttribute = formulaAttribute;
            Alias            = Name;
            Formula          = formulaAttribute.Query;
            ColumnType       = ColumnTypes.FormulaColumn;

            GetPropertyInfo();

            Logger.Trace($"Loaded database mapping for Property '{PropertyName}' of Entity '{Table.Type.Name}' (Column '{Name}')");
        }
Ejemplo n.º 3
0
        /// <summary> Write a Formula XML Element from attributes in a member. </summary>
        public virtual void WriteFormula(System.Xml.XmlWriter writer, System.Reflection.MemberInfo member, FormulaAttribute attribute, BaseAttribute parentAttribute, System.Type mappedClass)
        {
            writer.WriteStartElement( "formula" );

            WriteUserDefinedContent(writer, member, null, attribute);

            // Write the content of this element (mixed="true")
            writer.WriteString(attribute.Content);

            writer.WriteEndElement();
        }