public QuickLinkView(Lite <Entity> liteEntity)
 {
     lite      = liteEntity;
     IsVisible = Navigator.IsNavigable(lite.EntityType, null, isSearch: false);
     Text      = lite.EntityType.NiceName();
     Name      = Navigator.ResolveWebTypeName(liteEntity.EntityType);
 }
        protected virtual Dictionary <string, object> OptionsJSInternal()
        {
            var options = new Dictionary <string, object>
            {
                { "prefix", Prefix }
            };

            if (PartialViewName.HasText() && !Type.IsEmbeddedEntity())
            {
                options.Add("partialViewName", PartialViewName);
            }

            Type type = this.GetElementType();

            if (type.IsEmbeddedEntity())
            {
                if (Implementations != null)
                {
                    throw new ArgumentException("implementations should be null for EmbeddedEntities");
                }

                options.Add("types", new[] { type.ToJsTypeInfo(isSearch: false, prefix: Prefix) });

                PropertyRoute route = this.GetElementRoute();
                options.Add("rootType", Navigator.ResolveWebTypeName(route.RootType));
                options.Add("propertyRoute", route.PropertyString());
            }
            else
            {
                options.Add("types", Implementations.Value.ToJsTypeInfos(isSearch: false, prefix: Prefix));
            }

            if (this.ReadOnly)
            {
                options.Add("isReadOnly", this.ReadOnly);
            }

            if (Create)
            {
                options.Add("create", true);
            }
            if (Remove)
            {
                options.Add("remove", true);
            }
            if (Find)
            {
                options.Add("find", true);
            }
            if (View)
            {
                options.Add("view", true);
            }
            if (Navigate)
            {
                options.Add("navigate", this.Navigate);
            }

            return(options);
        }
Exemple #3
0
        public override string ToString()
        {
            if (EntityType != null && EntityType.IsLite())
            {
                throw new ArgumentException("RuntimeInfo's RuntimeType cannot be of type Lite. Use ExtractLite or construct a RuntimeInfo<T> instead");
            }

            return("{0};{1};{2};{3}".FormatWith(
                       Navigator.ResolveWebTypeName(EntityType),
                       IdOrNull?.ToString(),
                       IsNew ? "n" : "o",
                       Ticks
                       ));
        }
Exemple #4
0
        public static JsTypeInfo ToJsTypeInfo(this Type type, bool isSearch, string prefix)
        {
            var result = new JsTypeInfo()
            {
                name         = Navigator.ResolveWebTypeName(type),
                niceName     = type.NiceName(),
                creable      = Navigator.IsCreable(type, isSearch),
                findable     = Finder.IsFindable(type),
                preConstruct = new JRaw(Constructor.ClientManager.GetPreConstructorScript(new ClientConstructorContext(type, prefix))),
                avoidPopup   = (Navigator.Manager.EntitySettings.TryGetC(type)?.AvoidPopup) ?? false,
            };

            return(result);
        }