Enable the integration between Power Platform and SAP to announce changes in SAP to Power Platform asynchronously and so not in realtime, without coupling the both systems. A good design will take in consideration the existing design related to SAP (see image below).
...
Context and Problem
Current architecture implying a front door (micro-service) is mandatory. Direct access to SAP is not allowed.
No current integration between Power Platform and SAP. Power Platform is a SAAS in the public Internet even if it’s in the backbone of Microsoft.
For now, there is only a one-way communication, from SAP to Power Platform. Data transfered from SAP is not considered as confidential.
Data volume is not substantial : about 2 thousand records could be affected in Power Platform. Not a case of intensive computing and long-running functions.
Hybrid scenario is highly recommended regarding the current architecture related to SAP and the willing to upgrade the latter to Hana.
...
Solutions
Technology choices
Information below is established according the context (data volume, etc.). We know that Azure provides a multitude of services (as IAAS & ad PAAS).
...
Code Block | ||
---|---|---|
| ||
//Constructor
protected XrmRepository(IContextServices context)
{
OrganizationContextXrm = context.OrganizationContextPowerPlatform;
ServiceClientDataverse = context.ServiceClientDataverse;
CrmServiceClientDataverse = context.CrmServiceClientDataverse;
}
//Virtual Methods to override, but not mandatory
public virtual IEnumerable<T> FindAll(QueryExpression qe)
{
throw new NotImplementedException();
} |
Example of overriden method in a specific repository
Code Block | ||
---|---|---|
| ||
public override IEnumerable<Account> FindAll(QueryExpression qe) { List<Account> accounts = new List<Account>(); while (true) { EntityCollection enColl = ServiceClientDataverse.RetrieveMultiple(qe); if (enColl != null && enColl.Entities.Count > 0) { for (var i = 0; i <= enColl.Entities.Count - 1; i++) { var ent = enColl.Entities[i].ToEntity<Account>(); accounts.Add(ent); } } // Check for more records, if it returns true. if (enColl.MoreRecords) { qe.PageInfo.PageNumber++; // Increment the page number to retrieve the next page. qe.PageInfo.PagingCookie = enColl.PagingCookie; // Set the paging cookie to the paging cookie returned from current results. } else { break; //If no more records are in the result nodes, exit the loop. } } return accounts; } |