Пример #1
0
        public override bool BuildCustomFormat(OrmAttributeGroup attributeGroup, string attributeItemName,
                                               string valueLiteral, object realValue, ref StringBuilder attributeBuilder)
        {
            if (attributeGroup.In(OrmFieldAttribute.ATTRIBUTE_GROUP_FIELD_MAPPING, OrmFieldAttribute.ATTRIBUTE_GROUP_VERSION))
            {
                attributeBuilder.Append(valueLiteral);
                return(true);
            }

            return(base.BuildCustomFormat(attributeGroup, attributeItemName, valueLiteral, realValue, ref attributeBuilder));
        }
        public override bool BuildCustomFormat(OrmAttributeGroup attributeGroup, string attributeItemName,
                                               string valueLiteral, object realValue, ref StringBuilder attributeBuilder)
        {
            if (attributeGroup.In(OrmHierarchyRootAttribute.ATTRIBUTE_GROUP_TABLE_MAPPING))
            {
                attributeBuilder.Append(valueLiteral);
                return(true);
            }

            if (attributeGroup == OrmTypeDiscriminatorValueAttribute.ATTRIBUTE_GROUP_TYPE_DISCRIMINATOR_VALUE)
            {
                if (attributeItemName == OrmTypeDiscriminatorValueAttribute.ATTRIBUTE_GROUP_ITEM_VALUE)
                {
                    attributeBuilder.Append(valueLiteral + ",");
                    return(true);
                }
            }

            if (attributeGroup == OrmKeyGeneratorAttribute.ATTRIBUTE_GROUP_KEY_GENERATOR)
            {
                if (attributeItemName == OrmKeyGeneratorAttribute.ATTRIBUTE_GROUP_ITEM_KIND)
                {
                    attributeBuilder.Append(valueLiteral);
                    return(true);
                }
            }

            if (attributeGroup == EntityIndex.ATTRIBUTE_GROUP_INDEX)
            {
                if (attributeItemName == OrmIndexFields.ATTRIBUTE_GROUP_ITEM_KEY_FIELDS)
                {
                    string[] keyFields = (string[])realValue;
                    if (keyFields != null && keyFields.Length > 0)
                    {
                        //attributeBuilder.Append(string.Format("\"{0}\"", keyFieldItems[0]));
                        string allKeyFields = Util.JoinCollection(keyFields, ",", "\"");
                        attributeBuilder.Append(allKeyFields + ",");
                        return(true);
                    }
                }
            }

            return(base.BuildCustomFormat(attributeGroup, attributeItemName, valueLiteral, realValue, ref attributeBuilder));
        }