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); }
public static void ConfigureEntityButtons(EntityBase eb, Type cleanType) { eb.Create &= cleanType.IsEmbeddedEntity() ? Navigator.IsCreable(cleanType, isSearch: false) : eb.Implementations.Value.IsByAll ? false : eb.Implementations.Value.Types.Any(t => Navigator.IsCreable(t, isSearch: false)); eb.View &= cleanType.IsEmbeddedEntity() ? Navigator.IsViewable(cleanType, eb.PartialViewName) : eb.Implementations.Value.IsByAll ? true : eb.Implementations.Value.Types.Any(t => Navigator.IsViewable(t, eb.PartialViewName)); eb.Navigate &= cleanType.IsEmbeddedEntity() ? Navigator.IsNavigable(cleanType, eb.PartialViewName, isSearch: false) : eb.Implementations.Value.IsByAll ? true : eb.Implementations.Value.Types.Any(t => Navigator.IsNavigable(t, eb.PartialViewName, isSearch: false)); eb.Find &= cleanType.IsEmbeddedEntity() ? false : eb.Implementations.Value.IsByAll ? false : eb.Implementations.Value.Types.Any(t => Navigator.IsFindable(t)); }
public virtual void SetSearchViewableAndCreable(FindOptions findOptions, QueryDescription description) { var entityColumn = description.Columns.SingleEx(a => a.IsEntity); Type entitiesType = Lite.Extract(entityColumn.Type); Implementations?implementations = entityColumn.Implementations; if (findOptions.Navigate) { findOptions.Navigate = implementations.Value.IsByAll ? true : implementations.Value.Types.Any(t => Navigator.IsNavigable(t, null, true)); } if (findOptions.Create) { findOptions.Create = (implementations.Value.IsByAll ? true : implementations.Value.Types.Any(t => Navigator.IsCreable(t, true))); } }