Example #1
0
        private static string OnPartialViewName(TypeContext tc)
        {
            EntitySettings es = Navigator.EntitySettings(tc.UntypedValue.GetType());

            var result = es.OnPartialViewName((ModifiableEntity)tc.UntypedValue);

            tc.ViewOverrides = es.GetViewOverrides();
            return(result);
        }
Example #2
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.OnPartialViewName(entity) == null)
            {
                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);
        }