示例#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;
        }
示例#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);
 }
 public void RegisterMetadata(Type type, OmniMetadata metadata)
 {
     _metadata.Add(type, metadata);
 }
示例#5
0
 public void RegisterMetadata(Type type, Metadata metadata)
 {
     metadatas.Register(type, metadata);
 }
示例#6
0
 public static bool IsEmpty(Metadata metadata)
 {
     return typeof(Metadata).GetRuntimeProperties().All(info => info.GetValue(metadata) == null);
 }
示例#7
0
 protected bool Equals(Metadata other)
 {
     return Equals(PropertyDependencies, other.PropertyDependencies) && string.Equals(RuntimePropertyName, other.RuntimePropertyName);
 }