Example #1
0
        internal protected virtual bool OnIsNavigable(Type type, IEntity entity, bool isSearchEntity)
        {
            EntitySettings es = EntitySettings.TryGetC(type);

            return
                (es != null &&
                 es.HasView() &&
                 IsViewableBase(type, (ModifiableEntity)entity) &&
                 es.OnIsNavigable(isSearchEntity));
        }
Example #2
0
        internal protected virtual bool OnIsViewable(Type type, ModifiableEntity entity)
        {
            EntitySettings es = EntitySettings.TryGetC(type);

            return
                (es != null &&
                 es.HasView() &&
                 IsViewableBase(type, entity) &&
                 es.OnIsViewable());
        }
Example #3
0
        internal protected virtual EntitySettings AssertViewableEntitySettings(ModifiableEntity entity)
        {
            EntitySettings es = EntitySettings.TryGetC(entity.GetType());

            if (es == null)
            {
                throw new InvalidOperationException("No EntitySettings for type {0}".FormatWith(entity.GetType().Name));
            }

            if (!es.HasView())
            {
                throw new InvalidOperationException("No view has been set in the EntitySettings for {0}".FormatWith(entity.GetType().Name));
            }

            if (!IsViewableBase(entity.GetType(), entity))
            {
                throw new InvalidOperationException("Entities of type {0} are not viewable".FormatWith(entity.GetType().Name));
            }

            return(es);
        }