Tables

  • Entity tables are generally used by the entity methods for interacting with the database
  • Entity tables can be classified into Request tables and Response Tables.
  • This request/ response structure is determined as per the target method source property of Entity methods
  • The data in Entity tables is represented with the help of Entity Fields just like columns in a data table
  • Request tables, as the name suggests, are used to request data from the database based on certain parameters mentioned in the target method source property of the Entity method. These parameters are represented by entity fields
  • Response tables refer to the data/ information returned from the server and are also represented by entity fields
  • Entity Table comprises of the fields depending on the target_method_source of entity method.

Tables

An entity table can be used for one or more entity methods.

For an entity method, when the entity table is used as Request able, for some other entity method, it can be used as Response table, when the fields are same.

Field's Description

  • Has Error? This is internal field. If there is any inconsistency/improper in the setting of the entity/entity table/entity field, or if the steps that need to be followed in creating the entity is not followed, then “Has Error” will be highlighted in red color. Clicking it will provide the details of what that error was, with suggestions to fixing the error.

  • Table Name

    Represents the Entity table name under which the Table Fields are get added. Here it is internal (primary and foreign key) field.

    Need to provide the name of the entity table. It should be a unique name for that application.While creating new entity table, need to follow some naming procedures.

    Name should reflect for what entity / entity method it is going to be used for.

    If the table is going to be a Request table, then suffix the name with “Request”. Example as AccountTypeRequest.

    If the table is going to be used for Read purpose, then no need to any suffix. Example as AccountType.

    If the table is going to be used for Lookup control, then can name it like AccountTypeLookup.

    If the table is going to be used for CUD operation, then can name it like AccountTypeCUD.

  • Has No Key? Under entity method table fields, developer is expected to set the Key fields for that method table. For some cases, for an entity table, there could not have any fields that can be set as Key. In that case, developer need to set this “Has No Key” to true.
    By default, this option is false.

  • Description A short description on usage of this Entity Table.

  • Prominent Db Table Name

    This is the Db table name where most or all of the fields data are written in CUD operations.  This value will be used to track changes from audit logs, when such logs are written using MCL database table audit mechanism.

    When table is output to more than one table, mclsys.table_fields.db_table_name will be specified with the value that is different from prominent_db_table_name.

    The db_column_name will be matched up with audit trail Db table-column names.

  • MinOccurs This option is used with is_abstract, and when value of is_abstract option is set as true. This min_occurs and max_occurs represent minimum number of rows and maximum number of rows that are possible for a request/response table. Generally, but not always, input (request) table will have single row for various parameters of an input to a method (Ex. a WCF method for sql server function). Sometimes, the response from method could also be restricted from one to many rows. e.g. A scalar SQL function can return only one row with one field value. There are also several TVF examples of uni-row (one row with multiple fields).

  • MaxOccurs Is used with is_abstract, and when value of is_abstract = true.

  • Row Identifier Internal field.

  • Created User User who created that Entity object.

  • Created Date Date in which Entity object was created.

  • Updated User User who updated that Entity object lastly.

  • Updated Date Date in which Entity object was last modified.

  • Used in Methods It will show the count of entity methods in which this entity table is get used.

  • View Count It will show the number of views that is there for this entity table.

  • View Filter Count It will show the number of view filter that is there for this entity table.

  • Table Hierarchy Count It will show the number of hierarchies that is there for this entity table.

  • Sort Field Count It will show the number of sort fields that are got added for this entity table.

List of method where table is used

This screen is for display purpose only.

Under Entity Tables grid, when an entity table is selected, in the right side it will show in a grid, details of entity methods in which that select entity table is used.

It will be very helpful for the developer.

There will be hyperlinks on entity name and Entity method name. Clicking on it will take it to respective entity / entity methods.

Field's Description

  • Table Name

    Represents the Entity table name under which the Table Fields are get added. Here it is internal (primary and foreign key) field.

    Need to provide the name of the entity table. It should be a unique name for that application.While creating new entity table, need to follow some naming procedures.

    Name should reflect for what entity / entity method it is going to be used for.

    If the table is going to be a Request table, then suffix the name with “Request”. Example as AccountTypeRequest.

    If the table is going to be used for Read purpose, then no need to any suffix. Example as AccountType.

    If the table is going to be used for Lookup control, then can name it like AccountTypeLookup.

    If the table is going to be used for CUD operation, then can name it like AccountTypeCUD.

  • Table Type

    Need to pick the table type from the dropdown. There are 2 table types: Request and Response.
    A method table will consist of combination of Request and Response Tables.
    If the method just get input parameters and do not return back any data, then that method table will be have one request table and zero response table
    If the method do not get any input parameters and just return back one or more result sets of data from the database, then the method table will have zero request table and one or more response tables. The output of result sets needs to match with the number of response tables.
    If the method gets input parameters and returns back one or more result sets of data from the database, then the method table will have one request table and one or more response tables.

    Request Table:

    As the name suggests, request tables are used to request data from the database based on certain parameters mentioned in the target method source property of the Entity method. These are parameters represented by entity fields.
    There can be one request table for an entity method.
    If there are no parameters to the target method source property, then there is no need of a request table.

    If the method performs an insert or update or delete operation, then there will be one or more input parameters for the SP or SQL that is used for that method. For this case, entity table need to be created with the fields that are the parameters for the SP/SQL, and get that entity table added as Request table for that method.

    Response Table:

    This will be the output of the data returned from database, when the target method source of the method is executed.
    These are represented by Entity Fields.
    For an entity method there could zero or 1 or more response tables.

    If the SP/SQL used for that method do not return back any data from the database, then no need to set an entity table as response table.

    If the SP/SQL used for that method return back one or more result sets of data from the database, then need to create separate entity table for each of the result sets and set them as Response table.

  • Entity Name Name of the Entity. It should be unique for that module (database).

  • Method Name Need to provide the name of the Entity method. Entity method name should be unique for that database

  • Operation

    Need to select the database operation for which the Entity method is created. Possible options are: Create, CreateUpdateDelete, Delete, Execute, Read, Update, Validate.

    Operation Action
    C Create
    CUD CreateUpdateDelete
    D Delete
    E Execute
    R Read
    U Update
    V Validate

     

    When the method is going to be used to perform Insert, then select the Operation as C. (Method type 1, 2, 3, 6).

    When the method is going to be used to perform Create, Update and Delete, then select the Operation as CUD. (Method type 1).

    When the method is going to be used to perform Delete, then select the Operation as D. (Method type 1, 2, 3, 6).

    When the method is going to be used to execute a SQL Stored procedure or a DLL method, then select the Operation as E. (Method type 3, 6).

    When the method is going to be used to perform just Read only, then select the Operation as R. (Method type 1, 2, 3, 6).

    When the method is going to be used to perform just Update only, then select the Operation as U. (Method type 1, 2, 3, 6).

  • Method Type This specifies type for the db_method_name_core. The following types are possible

    0: System

    1: Table

    2: Sql

    3: SP (Non-Entity Compliant)

    4: SP (Entity Compliant)

    5: WCF URL

    6 : DLL

    Method Type:

     

    Table Type Description Notes
    0 System Reserved, do not use
    1 Table Method where database table is directly used.
    2 SQL Method is specified as SQL Statements. SQL may or may not have parameters
    3 SP (non-Entity Compliant) All SQL Server stored procedure (SP) methods. SP may or may not have parameters
    4 SP (Entity Compliant) It is only used few areas now. Do not use this method
    5 WCF URL Not implemented, do not use
    6 DLL For all DLL methods

     

     

  • Target Method Source

    Read Methods

    Cumulative Read Method: Read methods specified at method level for all response tables

    Non-Cumulative Read Method:  Read methods specified at each table level

     

     

    Request Tables for Read Methods:

     

    Request table is specified when there are parameters in SP or query or DLL methods (Method Type 2,3, 4, 6).

     

    In the query method below, @order_no is a parameter

    select * from order_detail where order_no = @order_no

     

    There are no parameters in the query method below. No request table is specified.

    select * from order_detail

    Request table can also be specified for Table Method (Method Type 1).  Its use is illustrated below.

     

    Target_method_source =  order_detail

    Request Table = OrderRequest, that has one field OrderNo whose db_column_name = order_no

     

    When the entity engine sees a request table specified, it is converted to a query like below

    select * from order_detail where order_no = @order_no

     

    This is useful when selecting just the records for particular order, instead reading the whole table.

     

    Deferred read

     

    Deferred read is applicable only to non-cumulative methods. It means the records are read, by execute the method, on navigating to the parent record for the first time.  Taking an example of a non-cumulative method, with two tables (parent-child). The child table records are read only when needed. On navigating to a specific parent record, child table records are fetched using parent table’s key.

     

    On non-cumulative methods, Deferred Read is set on child tables, as stated in table below.

    Method Type Request Tables specified Deferred Read Comments
    Query/SP Yes Yes If there is a request table, it means child table’s read method has parameters that uses parent table’s row value(s).
    Query/SP No No If there is no request table, the child table’s read method fetches data only once.
     
     
    Query is executed only once and all records are read
    Table Not Applicable Yes For any child table’s, whose read method is a non-cumulative method and has method_type = 1, it always set as deferred method.

     

    When to use Deferred Methods?

     

    Deferred Read fetches the child records as needed, and is required to execute the method on parent record navigation.  The fetch is performed only when navigating the parent for the first time, reused when the parent record is re-navigated.

     

    Non-deferred Read fetches all child records along with parent table. All child table records are read into memory (temp tables). On parent record navigation appropriate child records are filtered using parent key.

    Deferred read should be used when child tables are large (1000’s of records).  Non-Deferred will be useful when all of the child table records are a small (less few hundred records).   When child table records are small the non-deferred read method performance will be higher than deferred read method.

  • Method Source Internal Field.

  • Enable ? It’s Used to set whether that Entity object is enabled or disabled. When disabled, details of that entity object will not be get used.

  • Not Used? If the Entity Method is not used in any of the places, then can use this option can be set to True. By default this option is false.