/// <summary>
 ///   <para>Initializes a new instance of the <see cref="T:DevExpress.ExpressApp.DynamicCollectionBase" /> class with specified settings.</para>
 /// </summary>
 /// <param name="objectSpace">An Object Space for processing the collection objects.</param>
 /// <param name="objectType">A type of objects in the collection.</param>
 /// <param name="criteria">The filter criteria. The collection contains only objects that match this criteria.</param>
 /// <param name="sorting">A list of <see cref="T:DevExpress.Xpo.SortProperty" /> objects that specify the sort order for the collection.</param>
 /// <param name="inTransaction">true if the specified criteria and sorting parameters are applied to all objects (in the database and retrieved); otherwise, false.</param>
 public DynamicCollectionBase(
     IObjectSpace objectSpace,
     Type objectType,
     CriteriaOperator criteria,
     IList <SortProperty> sorting,
     bool inTransaction)
 {
     this.objectSpace = objectSpace;
     this.objectType  = objectType;
     this.criteria    = criteria;
     this.sorting     = new List <SortProperty>();
     if (sorting != null)
     {
         this.sorting.AddRange((IEnumerable <SortProperty>)sorting);
     }
     this.inTransaction = inTransaction;
     this.propertyDescriptorCollection = new XafPropertyDescriptorCollection(objectSpace.TypesInfo.FindTypeInfo(objectType));
     foreach (IMemberInfo displayableMember in (IEnumerable <IMemberInfo>) this.GetDefaultDisplayableMembers(this.propertyDescriptorCollection.TypeInfo))
     {
         this.propertyDescriptorCollection.CreatePropertyDescriptor(displayableMember, displayableMember.Name);
     }
     this.newObjectIndex         = -1;
     this.allowNew               = true;
     this.allowEdit              = true;
     this.allowRemove            = true;
     objectSpace.ObjectReloaded += new EventHandler <ObjectManipulatingEventArgs>(this.ObjectSpace_ObjectReloaded);
 }
 /// <summary>
 ///   <para>Disposes of all resources this <see cref="T:DevExpress.ExpressApp.DynamicCollectionBase" /> object uses. This method is implemented to support the <see cref="T:System.IDisposable" /> interface.</para>
 /// </summary>
 public void Dispose()
 {
     this.isDisposed  = true;
     this.ListChanged = (ListChangedEventHandler)null;
     if (this.objects != null)
     {
         this.objects.Clear();
         this.objects = (List <object>)null;
     }
     if (this.objectSpace != null)
     {
         this.objectSpace.ObjectReloaded -= new EventHandler <ObjectManipulatingEventArgs>(this.ObjectSpace_ObjectReloaded);
         this.objectSpace = (IObjectSpace)null;
     }
     this.propertyDescriptorCollection = (XafPropertyDescriptorCollection)null;
 }
예제 #3
0
 public void Dispose()
 {
     isDisposed  = true;
     ListChanged = null;
     if (objects != null)
     {
         objects.Clear();
         objects = null;
     }
     if (objectSpace != null)
     {
         objectSpace.ObjectReloaded -= new EventHandler <ObjectManipulatingEventArgs>(ObjectSpace_ObjectReloaded);
         objectSpace = null;
     }
     propertyDescriptorCollection = null;
 }
예제 #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);
 }
예제 #5
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);
     }
 }
예제 #7
0
 public void Dispose()
 {
     isDisposed = true;
     ListChanged = null;
     if (objects != null)
     {
         objects.Clear();
         objects = null;
     }
     if (objectSpace != null)
     {
         objectSpace.ObjectReloaded -= new EventHandler<ObjectManipulatingEventArgs>(ObjectSpace_ObjectReloaded);
         objectSpace = null;
     }
     propertyDescriptorCollection = null;
 }
예제 #8
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);
 }