Skip to content

How to register a details view for a entity

David Schöne edited this page Jul 26, 2019 · 6 revisions

Goal

If there are several entities in the system and they are mapped in the search, the target is to load a different details view for each entity.

Introduction

To call a seperate view from the search for an own entity, you need 2 extensions

  1. when installing the entity, the information to which module the entity belongs must be stored.
  2. a function for the mode Show must be created in the manifest file.

Workflow

  1. when installing the entity, the information to which module the entity belongs must be stored. Example
#region create entities

// Entities
Entity entity = entityManager.Entities.Where(e => e.Name.ToUpperInvariant() == "Sample".ToUpperInvariant()).FirstOrDefault();

if (entity == null)
{
    entity = new Entity();
    entity.Name = "Sample";
    entity.EntityType = typeof(Dataset);
    entity.EntityStoreType = typeof(Xml.Helpers.DatasetStore);
    entity.UseMetadata = true;
    entity.Securable = true;

    //add to Extra

    XmlDocument xmlDoc = new XmlDocument();
    XmlDatasetHelper xmlDatasetHelper = new XmlDatasetHelper();
    xmlDatasetHelper.AddReferenceToXml(xmlDoc, AttributeNames.name.ToString(), "rdb", AttributeType.parameter.ToString(), "extra/modules/module");

    entity.Extra = xmlDoc;

    entityManager.Create(entity);
}
else
{
    if (entity.Extra == null)
    {
       //update to Extra

       XmlDocument xmlDoc = new XmlDocument();
       xmlDoc.AppendChild(entity.Extra);

       XmlDatasetHelper xmlDatasetHelper = new XmlDatasetHelper();
       xmlDatasetHelper.AddReferenceToXml(xmlDoc, AttributeNames.name.ToString(), "rdb", AttributeType.parameter.ToString(), "extra/modules/module");

       entity.Extra = xmlDoc;

       entityManager.Update(entity);
    }
}


#endregion
  1. a function for the mode Show must be created in the manifest file.
<EntityActions>
    <EntityAction id="showSample" entity="sample" controller="Sample" action="Show" area="Rdb" modus="show"/>
  </EntityActions>

Test

  1. create an object of the entity X
  2. open the search
  3. when you have found the object, open the detail view

Clone this wiki locally