private static IEnumerable<PropertyInfo> GetOrCreatePropertyInfos(IEditableObject model)
 {
     var modelType = model.GetType();
     if (_propertyInfos.ContainsKey(modelType))
         return _propertyInfos[modelType];
     else
         return from p in model.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public)
                where p.SetMethod != null
                select p;
 }
示例#2
0
    public void AsyncLoadManagerSerializationTest()
    {
      Csla.Test.Basic.Children list = Csla.Test.Basic.Children.NewChildren();
      list.Add("1");
      list.Add("2");
      IEditableObject item = list[1] as IEditableObject;
      int editLevel = (int)item.GetType().GetProperty("EditLevel", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.FlattenHierarchy).GetValue(item, null);
      object manager = item.GetType().GetProperty("LoadManager", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.FlattenHierarchy).GetValue(item, null);

      item.BeginEdit();
      int newEditLevel = (int)item.GetType().GetProperty("EditLevel", System.Reflection.BindingFlags.Public | System.Reflection.BindingFlags.NonPublic | System.Reflection.BindingFlags.Instance | System.Reflection.BindingFlags.FlattenHierarchy).GetValue(item, null);
      Assert.AreEqual(editLevel + 1, newEditLevel, "Edit level incorrect after begin edit");
    }
        private static IEnumerable <PropertyInfo> GetOrCreatePropertyInfos(IEditableObject model)
        {
            var modelType = model.GetType();

            if (_propertyInfos.ContainsKey(modelType))
            {
                return(_propertyInfos[modelType]);
            }
            else
            {
                return(from p in model.GetType().GetProperties(BindingFlags.Instance | BindingFlags.Public)
                       where p.SetMethod != null
                       select p);
            }
        }