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));
        }
示例#2
0
        public Dictionary <string, Defaultable> GetAttributeGroupItems(OrmAttributeGroup @group)
        {
            var result = new Dictionary <string, Defaultable>();

            if (group == ATTRIBUTE_GROUP_INDEX)
            {
                result.Add(ATTRIBUTE_GROUP_ITEM_UNIQUE, Unique);
                result.Add(ATTRIBUTE_GROUP_ITEM_FILLFACTOR, FillFactor);
                result.Add(ATTRIBUTE_GROUP_ITEM_NAME, IndexName);
                this.Fields.FillAttributeGroupItems(/*group, */ result);
            }

            return(result);
        }
示例#3
0
        public Dictionary <string, Defaultable> GetAttributeGroupItems(IOrmAttribute attribute,
                                                                       OrmAttributeGroup attributeGroup)
        {
            if (attributeItems.ContainsKey(attribute))
            {
                var attributeGroupItems = attributeItems[attribute].AttributeGroupItems;
                if (attributeGroupItems.ContainsGroup(attributeGroup))
                {
                    return(attributeGroupItems[attributeGroup]);
                }
            }

            return(new Dictionary <string, Defaultable>());
        }
        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));
        }
        public override IEnumerable <KeyValuePair <string, Defaultable> > SortAttributeGroupItems(
            OrmAttributeGroup attributeGroup, Dictionary <string, Defaultable> attributeGroupItems)
        {
            IComparer <string> customComparer = null;

            if (attributeGroup == EntityIndex.ATTRIBUTE_GROUP_INDEX)
            {
                customComparer = new IndexKeyFieldsComparer();
            }

            if (attributeGroup == OrmTypeDiscriminatorValueAttribute.ATTRIBUTE_GROUP_TYPE_DISCRIMINATOR_VALUE)
            {
                customComparer = new TypeDiscriminatorValueFieldsComparer();
            }

            if (customComparer != null)
            {
                return(attributeGroupItems.ToList().OrderBy(pair => pair.Key, customComparer));
            }

            return(base.SortAttributeGroupItems(attributeGroup, attributeGroupItems));
        }
示例#6
0
 public virtual IEnumerable <KeyValuePair <string, Defaultable> > SortAttributeGroupItems(
     OrmAttributeGroup attributeGroup, Dictionary <string, Defaultable> attributeGroupItems)
 {
     return(attributeGroupItems.ToList());
 }
示例#7
0
 public virtual bool BuildCustomFormatComplete(OrmAttributeGroup attributeGroup, Dictionary <string, Defaultable> attributeGroupItems,
                                               ref StringBuilder attributeBuilder)
 {
     return(false);
 }
示例#8
0
 public virtual bool BuildCustomFormat(OrmAttributeGroup attributeGroup, string attributeItemName,
                                       string valueLiteral, object realValue, ref StringBuilder attributeBuilder)
 {
     return(false);
 }
示例#9
0
 internal bool ContainsGroup(OrmAttributeGroup @group)
 {
     return(this.Keys.Any(item => item.EqualsTo(@group)));
 }