Esempio n. 1
0
        public Metadata Get(Type type)
        {
            var metadata = new Metadata();
            foreach (var prop in MedataProperties)
            {
                AutoKeyDictionary<Type, object> dic;
                var hadDictionary  = lookupDictionaries.TryGetValue(prop.Name, out dic);
                if (hadDictionary)
                {
                    object value;
                    var hadValue = dic.TryGetValue(type, out value);
                    if (hadValue)
                    {
                        prop.SetValue(metadata, value);
                    }
                    else
                    {
                        prop.SetValue(metadata, null);
                    }
                }
                else
                {
                    prop.SetValue(metadata, null);
                }
            }

            return metadata;
        }
Esempio n. 2
0
 public void Register(Type type, Metadata medataData)
 {
     foreach (var propertyInfo in medataData.GetType().GetRuntimeProperties())
     {
         var dic = GetDictionary(propertyInfo.Name);
         var value = propertyInfo.GetValue(medataData);
         if (value != null)
         {
             dic.Add(type, value);
         }
     }
 }
 public void RegisterMetadata(Type type, OmniMetadata metadata)
 {
     _metadata.Add(type, metadata);
 }
Esempio n. 4
0
 public void RegisterMetadata(Type type, Metadata metadata)
 {
     metadatas.Register(type, metadata);
 }
Esempio n. 5
0
 public static bool IsEmpty(Metadata metadata)
 {
     return typeof(Metadata).GetRuntimeProperties().All(info => info.GetValue(metadata) == null);
 }
Esempio n. 6
0
 protected bool Equals(Metadata other)
 {
     return Equals(PropertyDependencies, other.PropertyDependencies) && string.Equals(RuntimePropertyName, other.RuntimePropertyName);
 }