Tuesday, August 30, 2011

ForceLiterals and ForcePlaceHolders in AX


When you use forceliterals keywords in Axapta, Axapta will issue SQL statements directly to the database as text string.
SELECT forceLiterals * FROM purchTable
    WHERE purchId == ‘EN00009’ ;
In SQL server, it will be:
SELECT A.VALUE, A.MODIFIEDTIME, A.CREATEDTIME, A.RECID FROM HINTTABLE A(NOLOCK) WHERE (PURCHID="EN00009") OPTION(FAST 47)
Conversely, using ForcePlaceHolders in Axapta, Axapta will issue SQL statements to the database, and a temporary stored procedure being created for this statement. This stored procedure then remains within the database for as long as the connection that was used when issuing the statement remains.
SELECT forcePlaceHolders * FROM purchTable
    WHERE purchId == ‘EN00009’ ;
In SQL server, it will be:
SELECT A.VALUE, A.MODIFIEDTIME, A.CREATEDTIME, A.RECID FROM HINTTABLE A(NOLOCK) WHERE (PURCHID=" @P1") OPTION(FAST 47)
Using forcePlaceHolders will help SQL Server to save the time to recompile the execution plan, that is, reuse the execution plan.
Excess use of the forcePlaceHolders can degrade performance. If a statement is executed only once, forceLiterals is preferred because it requires only one network round trip to the server. While using forcePlaceHolders for a statement executed only one time requires an extra network round-trip; one trip to prepare the statement and one trip to execute it.

Monday, August 29, 2011

DictTable and DictField Class

Hi ,
    Take a look below on DictTable and DictField class in AX.

Note : DictTable class is used to access information ralated to table.

Note : DictField class is used to access information ralated to table fields.

DictTable dt;
;

dt = new DictTable(tablenum(Address));

if (dt)
{
    print (strfmt("The table is saved on a %1 basis.", dt.dataPrCompany() ? "per company" : "global"));
}
#macrolib.dictfield

DictField df;

int       nFlags;

;

df = new DictField(tablenum(CustTable), fieldnum(CustTable, AccountNum));

if (df)
{
    nFlags = df.flags();
    if (bitTest(nFlags,#DBF_MANDATORY))
    {
        print ("The field is mandatory.");
    }
    else
    {
        print ("The field is not mandatory.");
    }

}

Thursday, August 18, 2011

Service Accounts


        Local System : Completely trusted account, more so than the administrator account. There is nothing on a single box that this account can not do and it has the right to access the network as the machine (this requires Active Directory and granting the machine account permissions to something)
        
         Network Service : Limited service account that is meant to run standard least-privileged services. This account is far more limited than Local System (or even Administrator) but still has the right to access the network as the machine (see caveat above)

      Local Service : A limited service account that is very similar to Network Service and meant to run standard least-privileged services. However unlike Network Service it has no ability to access the network as the machine.

Cheers!!!