Esempio n. 1
0
 public NHCollection(NHObjectSpace objectSpace, Type objectType, CriteriaOperator criteria, IList <SortProperty> sorting, Boolean inTransaction)
 {
     this.objectSpace = objectSpace;
     this.objectType  = objectType;
     this.criteria    = criteria;
     this.sorting     = new List <SortProperty>();
     if (sorting != null)
     {
         this.sorting.AddRange(sorting);
     }
     this.inTransaction           = inTransaction;
     propertyDescriptorCollection = new XafPropertyDescriptorCollection(objectSpace.TypesInfo.FindTypeInfo(objectType));
     foreach (IMemberInfo memberInfo in NHObjectSpace.GetDefaultDisplayableMembers(propertyDescriptorCollection.TypeInfo))
     {
         propertyDescriptorCollection.CreatePropertyDescriptor(memberInfo, memberInfo.Name);
     }
     newObjectIndex              = -1;
     allowNew                    = true;
     allowEdit                   = true;
     allowRemove                 = true;
     objectSpace.ObjectReloaded += new EventHandler <ObjectManipulatingEventArgs>(ObjectSpace_ObjectReloaded);
 }
Esempio n. 2
0
        private PropertyDescriptorCollection GetProperties(Type type)
        {
            var typeInfo = TypesInfo.FindTypeInfo(type);

            if (typeInfo != null)
            {
                var collection  = new XafPropertyDescriptorCollection(typeInfo);
                var descriptors = new List <PropertyDescriptor>();
                foreach (var memberInfo in typeInfo.Members.Where(m => !m.IsKey))
                {
                    var descriptor = collection.CreatePropertyDescriptor(memberInfo, memberInfo.Name);
                    if (descriptor.IsBrowsable)
                    {
                        descriptors.Add(GetSupportedPropertyDescriptor(descriptor));
                    }
                }

                return(new PropertyDescriptorCollection(descriptors.ToArray()));
            }
            else
            {
                return(TypeDescriptor.GetProperties(type));
            }
        }
 public NHServerModeSourceAdderRemover(Object serverModeSource, NHObjectSpace objectSpace, Type objectType)
 {
     this.serverModeSource = serverModeSource;
     this.objectSpace = objectSpace;
     this.objectType = objectType;
     listServer = serverModeSource as IListServer;
     listServerHints = serverModeSource as IListServerHints;
     bindingList = serverModeSource as IBindingList;
     typedList = serverModeSource as ITypedList;
     dxCloneable = serverModeSource as IDXCloneable;
     addedObjects = new List<Object>();
     addedObjectsDictionary = new Dictionary<Object, Byte>();
     removedObjectsDictionary = new Dictionary<Object, Byte>();
     bindingList.ListChanged += new ListChangedEventHandler(bindingList_ListChanged);
     ITypeInfo typeInfo = objectSpace.TypesInfo.FindTypeInfo(objectType);
     propertyDescriptorCollection = new XafPropertyDescriptorCollection(typeInfo);
     foreach (IMemberInfo memberInfo in NHObjectSpace.GetDefaultDisplayableMembers(typeInfo))
     {
         propertyDescriptorCollection.CreatePropertyDescriptor(memberInfo, memberInfo.Name);
     }
 }
Esempio n. 4
0
 public NHCollection(NHObjectSpace objectSpace, Type objectType, CriteriaOperator criteria, IList<SortProperty> sorting, Boolean inTransaction)
 {
     this.objectSpace = objectSpace;
     this.objectType = objectType;
     this.criteria = criteria;
     this.sorting = new List<SortProperty>();
     if (sorting != null)
     {
         this.sorting.AddRange(sorting);
     }
     this.inTransaction = inTransaction;
     propertyDescriptorCollection = new XafPropertyDescriptorCollection(objectSpace.TypesInfo.FindTypeInfo(objectType));
     foreach (IMemberInfo memberInfo in NHObjectSpace.GetDefaultDisplayableMembers(propertyDescriptorCollection.TypeInfo))
     {
         propertyDescriptorCollection.CreatePropertyDescriptor(memberInfo, memberInfo.Name);
     }
     newObjectIndex = -1;
     allowNew = true;
     allowEdit = true;
     allowRemove = true;
     objectSpace.ObjectReloaded += new EventHandler<ObjectManipulatingEventArgs>(ObjectSpace_ObjectReloaded);
 }