🚀 Welcome to MDriven Learn –  Don’t miss the latest Release Notes.
WebApi
This page was created by Hans.karlsen on 2019-01-21. Last edited by Restore-user on 2026-10-21.

The central communication between an MDriven application and its Remote Persistence Layer is handled by PersistenceProvider. During the many iterations of development, this has been implemented with RPC and WCF (until recently, the current one), and the new implementation is WebApi.

To use WebAPI communication instead of WCF, utilize the new PersistenceMapperWEBAPIClient (MDriven.Net.Http.dll) instead of PersistenceMapperWCFClient. On the server, subclass the public abstract class MDrivenPersistenceController<T> : ApiController (MDriven.Persistence.WebApi.dll).

How to Switch From WCF to WebAPI

Suppose you have this now:

yourEcoSpace.PersistenceMapper = persistenceMapperWCFClient;
persistenceMapperWCFClient.Uri = "https://YourServerMDrivenServer/APP_A0/A0_PMPWCF.svc";
persistenceMapperWCFClient.WCFServerUserName="SomeMDrivenServerUser"
persistenceMapperWCFClient.WCFServerPassword="**********";

All you have to do to use WebApi instead of WCF is create an instance of PersistenceMapperWEBAPIClient and do this:

yourEcoSpace.PersistenceMapper = persistenceMapperWEBAPIClient;
persistenceMapperWEBAPIClient.Uri = "https://YourServerMDrivenServer/api/A0_WebApi";
persistenceMapperWEBAPIClient.ServerUserName="SomeMDrivenServerUser"
persistenceMapperWEBAPIClient.ServerPassword="**********";
  

 
  

Create a Server

In an IIS-WebApp (or similar), I suggest a folder WebAPI; in this, create a new WebApiController

Change the superclass used to MDrivenPersistenceController<YourPMP>

public class A0_WebApiController : MDrivenPersistenceController<YourPMP>