WebApi
No edit summary
(Replacing message template with parser tag)
 
(7 intermediate revisions by 3 users not shown)
Line 1: Line 1:
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, WCF(until recently the current) and the new implementation is WebApi.
<message>Write the content here to display this box</message>
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, WCF(until recently the current) and the new implementation is WebApi.


To use WebAPI communication instead of WCF you use the new PersistenceMapperWEBAPIClient (MDriven.Net.Http.dll) instead of PersistenceMapperWCFClient. And on the server, you subclass the public abstract class MDrivenPersistenceController<T> : ApiController (MDriven.Persistence.WebApi.dll).
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 ===
=== How to Switch From WCF to WebAPI ===
Suppose you have this now:
Suppose you have this now:
  yourEcoSpace.PersistenceMapper = persistenceMapperWCFClient;
  yourEcoSpace.PersistenceMapper = persistenceMapperWCFClient;
Line 9: Line 10:
  persistenceMapperWCFClient.WCFServerUserName="SomeMDrivenServerUser"
  persistenceMapperWCFClient.WCFServerUserName="SomeMDrivenServerUser"
  persistenceMapperWCFClient.WCFServerPassword="**********";
  persistenceMapperWCFClient.WCFServerPassword="**********";
All you have to do in order to use WebApi instead of WCF is to create an instance of PersistenceMapperWEBAPIClient instead and go like this
All you have to do to use WebApi instead of WCF is create an instance of PersistenceMapperWEBAPIClient and do this:
  yourEcoSpace.PersistenceMapper = persistenceMapperWEBAPIClient;
  yourEcoSpace.PersistenceMapper = persistenceMapperWEBAPIClient;
  persistenceMapperWEBAPIClient.Uri = "<nowiki>https://YourServerMDrivenServer/api/A0_WebApi</nowiki>";
  persistenceMapperWEBAPIClient.Uri = "<nowiki>https://YourServerMDrivenServer/api/A0_WebApi</nowiki>";
  persistenceMapperWEBAPIClient.ServerUserName="SomeMDrivenServerUser"
  persistenceMapperWEBAPIClient.ServerUserName="SomeMDrivenServerUser"
  persistenceMapperWEBAPIClient.ServerPassword="**********";
  persistenceMapperWEBAPIClient.ServerPassword="**********";
[[Category:JSON]]
  [[Category:JSON]]
[[Category:API]]
 
  [[Category:API]]
 
=== Create a Server ===
[[File:2023-07-24 14h01 12.png|none|thumb]]
In a IIS-WebApp (or similair) I suggest a folder WebAPI, in this create a new WebApiController
 
Change used superclass to use the MDrivenPersistenceController<YourPMP>
public class A0_WebApiController : MDrivenPersistenceController<YourPMP>
{{Edited|July|12|2024}}

Latest revision as of 08:00, 17 June 2024

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, WCF(until recently the current) 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

2023-07-24 14h01 12.png

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

Change used superclass to use the MDrivenPersistenceController<YourPMP>

public class A0_WebApiController : MDrivenPersistenceController<YourPMP>
This page was edited 95 days ago on 06/17/2024. What links here