Exemple #1
0
 /// <summary>
 /// Displays the object in grid.
 /// </summary>
 /// <param name="objectToDisplay">The object to display.</param>
 /// <param name="options">The options.</param>
 public override void DisplayObjectInGrid(object objectToDisplay, GridOptions options)
 {
     if (objectToDisplay != null)
     {
         Type elementType = LinqUtils.DetermineSetElementType(objectToDisplay.GetType());
         if (typeof(IEntityCore).IsAssignableFrom(elementType))
         {
             var membersToExclude = typeof(EntityBase).GetProperties().Select(p => p.Name)
                                    .Union(typeof(EntityBase2).GetProperties().Select(p => p.Name)).Distinct();
             if (typeof(IEntity).IsAssignableFrom(elementType))
             {
                 // remove alwaysFetch/AlreadyFetched flag properties
                 membersToExclude = membersToExclude
                                    .Union(elementType.GetProperties()
                                           .Where(p => p.PropertyType == typeof(bool) &&
                                                  (p.Name.StartsWith("AlreadyFetched") || p.Name.StartsWith("AlwaysFetch")))
                                           .Select(p => p.Name));
             }
             options.MembersToExclude = membersToExclude.Distinct().ToArray();
         }
     }
     base.DisplayObjectInGrid(objectToDisplay, options);
 }