protected void CreateMappedMetadata(HbmMeta[] metadatas)
		{
			if (metadatas == null)
			{
				mappedMetaData = EmptyMetaData;
				inheritableMetaData = EmptyMetaData;
				return;
			}
			mappedMetaData = new Dictionary<string, MetaAttribute>(10);
			inheritableMetaData = new Dictionary<string, MetaAttribute>(10);

			foreach (var hbmMeta in metadatas)
			{
				MetaAttribute attribute;
				if (!mappedMetaData.TryGetValue(hbmMeta.attribute, out attribute))
				{
					attribute = new MetaAttribute(hbmMeta.attribute);
					mappedMetaData[hbmMeta.attribute] = attribute;
					if(hbmMeta.inherit)
					{
						inheritableMetaData[hbmMeta.attribute] = attribute;
					}
				}
				if (hbmMeta.Text != null)
				{
					attribute.AddValue(string.Concat(hbmMeta.Text));
				}
			}
		}
예제 #2
0
		public static IDictionary<string, MetaAttribute> GetMetas(IDecoratable decoratable, IDictionary<string, MetaAttribute> inheritedMeta, bool onlyInheritable)
		{
			if(decoratable == null)
			{
				return EmptyMeta;
			}
			var map = new Dictionary<string, MetaAttribute>(inheritedMeta);

			IDictionary<string, MetaAttribute> metaAttributes = onlyInheritable
			                                                    	? decoratable.InheritableMetaData
			                                                    	: decoratable.MappedMetaData;

			foreach (var metaAttribute in metaAttributes)
			{
				string name = metaAttribute.Key;

				MetaAttribute meta;
				MetaAttribute inheritedAttribute;

				map.TryGetValue(name, out meta);
				inheritedMeta.TryGetValue(name, out inheritedAttribute);

				if (meta == null)
				{
					meta = new MetaAttribute(name);
					map[name] = meta;
				}
				else if (meta == inheritedAttribute)
				{
					// overriding inherited meta attribute.
					meta = new MetaAttribute(name);
					map[name] = meta;
				}
				meta.AddValues(metaAttribute.Value.Values);
			}
			return map;
		}
예제 #3
0
		private static IDictionary GetMetas( XmlNode node )
		{
			IDictionary map = new Hashtable();

			foreach( XmlNode metaNode in node.SelectNodes( nsMeta, nsmgr ) )
			{
				string name = metaNode.Attributes["attribute"].Value;
				MetaAttribute meta = (MetaAttribute) map[name];
				if( meta == null )
				{
					meta = new MetaAttribute();
					map[name] = meta;
				}
				meta.AddValue( metaNode.InnerText );
			}

			return map;
		}
예제 #4
0
        protected IDictionary<string, MetaAttribute> GetMetas(XmlNode node)
        {
            Dictionary<string, MetaAttribute> map = new Dictionary<string, MetaAttribute>();

            foreach (XmlNode metaNode in node.SelectNodes(HbmConstants.nsMeta, namespaceManager))
            {
                string name = metaNode.Attributes["attribute"].Value;
                MetaAttribute meta;
                if (!map.TryGetValue(name, out meta))
                {
                    meta = new MetaAttribute(name);
                    map[name] = meta;
                }
                meta.AddValue(metaNode.InnerText);
            }

            return map;
        }
예제 #5
0
        private static IDictionary<string, MetaAttribute> GetMetas(HbmId idSchema)
        {
            Dictionary<string, MetaAttribute> map = new Dictionary<string, MetaAttribute>();

            foreach (HbmMeta metaSchema in idSchema.meta ?? new HbmMeta[0])
            {
                MetaAttribute meta;
                if (!map.TryGetValue(metaSchema.attribute, out meta))
                {
                    meta = new MetaAttribute(metaSchema.attribute);
                    map[metaSchema.attribute] = meta;
                }

                meta.AddValue(metaSchema.GetText());
            }

            return map;
        }