9using System.Collections.Generic;
23 private static Type _proxyType;
36 var type = Type.GetType(descriptor.ProxyTypeName);
37 if (ApplicationContext.CurrentServiceProvider !=
null)
39 var httpClient = ApplicationContext.CurrentServiceProvider.GetService(typeof(System.Net.Http.HttpClient));
40 if (httpClient ==
null)
41 return (
IDataPortalProxy)MethodCaller.CreateInstance(type, descriptor.DataPortalUrl);
43 return (
IDataPortalProxy)MethodCaller.CreateInstance(_proxyType, httpClient, descriptor.DataPortalUrl);
47 return (
IDataPortalProxy)MethodCaller.CreateInstance(type, descriptor.DataPortalUrl);
52 if (_proxyType ==
null)
54 string proxyTypeName = ApplicationContext.DataPortalProxy;
55 if (proxyTypeName ==
"Local")
58 _proxyType = Type.GetType(proxyTypeName,
true,
true);
60 var provider = ApplicationContext.CurrentServiceProvider;
67 var httpClient = ApplicationContext.CurrentServiceProvider.GetService(typeof(System.Net.Http.HttpClient));
68 if (httpClient ==
null)
71 return (
IDataPortalProxy)MethodCaller.CreateInstance(_proxyType, httpClient);
75 return (
IDataPortalProxy)Microsoft.Extensions.DependencyInjection.ActivatorUtilities.CreateInstance(provider, _proxyType);
106 {
get;
private set; }
108 private static void InitializeDictionary()
121 InitializeDictionary();
132 InitializeDictionary();
143 InitializeDictionary();
154 return $
"{objectType.FullName}, {objectType.Assembly.FullName.Substring(0, objectType.Assembly.FullName.IndexOf(",
"))}";
163 [System.ComponentModel.EditorBrowsable(System.ComponentModel.EditorBrowsableState.Never)]
167 if (attributes !=
null && attributes.Count() > 0)
Describes the data portal proxy for use by a specific business object type.
Default data portal proxy factory that creates the IDataPortalProxy instance to use for the DataPorta...
static void AddDescriptor(int resourceId, DataPortalProxyDescriptor descriptor)
Add a proxy descriptor for the specified root business type.
static void AddDescriptor(Type objectType, DataPortalProxyDescriptor descriptor)
Add a proxy descriptor for the specified root business type.
static Dictionary< string, DataPortalProxyDescriptor > DataPortalTypeProxyDescriptors
Gets the list of proxy-type mapping descriptors used to create specific proxy objects for specific bu...
static string GetTypeName(Type objectType)
Returns a type name formatted to act as a key in the DataPortalTypeProxyDescriptors dictionary.
static string GetTypeKey(Type objectType)
Returns the key used by the proxy factory to locate a DataPortalProxyDescriptor in the DataPortalProx...
static void AddDescriptor(string typeName, DataPortalProxyDescriptor descriptor)
Add a proxy descriptor for the specified root business type.
IDataPortalProxy Create(Type objectType)
Creates the DataPortalProxy to use for DataPortal call on the objectType.
void ResetProxyType()
Resets the data portal proxy type, so the next data portal call will reload the proxy type based on c...
Implements a data portal proxy to relay data portal calls to a remote application server by using htt...
Implements a data portal proxy to relay data portal calls to an application server hosted locally in ...
Specifies a server resource required by a business type so the data portal can route any calls to the...
Interface implemented by client-side data portal proxy objects.