CSLA.NET 5.4.2
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
CslaDataPortalConfiguration.cs
Go to the documentation of this file.
1//-----------------------------------------------------------------------
2// <copyright file="CslaDataPortalConfiguration.cs" company="Marimer LLC">
3// Copyright (c) Marimer LLC. All rights reserved.
4// Website: https://cslanet.com
5// </copyright>
6// <summary>Use this type to configure the settings for CSLA .NET</summary>
7//-----------------------------------------------------------------------
8using System;
9using System.Collections.Generic;
10
11namespace Csla.Configuration
12{
16 public static class CslaDataPortalConfigurationExtension
17 {
21 public static CslaDataPortalConfiguration DataPortal(this ICslaConfiguration config)
22 {
23 return new CslaDataPortalConfiguration();
24 }
25 }
26
32 {
39 public CslaDataPortalConfiguration DefaultProxy(Type type, string defaultUrl)
40 {
41 DefaultProxy(type.AssemblyQualifiedName, defaultUrl);
42 return this;
43 }
44
51 public CslaDataPortalConfiguration DefaultProxy(string typeName, string defaultUrl)
52 {
53 ConfigurationManager.AppSettings["CslaDataPortalProxy"] = typeName;
54 ConfigurationManager.AppSettings["CslaDataPortalUrl"] = defaultUrl;
55 return this;
56 }
57
64 public CslaDataPortalConfiguration ProxyDescriptors(List<Tuple<string, string, string>> descriptors)
65 {
66 DataPortalClient.DataPortalProxyFactory.DataPortalTypeProxyDescriptors?.Clear();
67
68 foreach (var item in descriptors)
69 {
70 if (int.TryParse(item.Item1, out int result))
71 {
73 result,
74 new DataPortalClient.DataPortalProxyDescriptor { ProxyTypeName = item.Item2, DataPortalUrl = item.Item3 });
75 }
76 else
77 {
78 try
79 {
80 var type = Type.GetType(item.Item1);
82 type,
83 new DataPortalClient.DataPortalProxyDescriptor { ProxyTypeName = item.Item2, DataPortalUrl = item.Item3 });
84 }
85 catch (NullReferenceException ex)
86 {
87 throw new ArgumentException(item.Item1, ex);
88 }
89 }
90 }
91 return this;
92 }
93
102 {
103 ProxyFactoryType(type.AssemblyQualifiedName);
104 return this;
105 }
106
115 {
116 ConfigurationManager.AppSettings["CslaDataPortalProxyFactory"] = typeName;
117 return this;
118 }
119
125 {
126 ActivatorType(type.AssemblyQualifiedName);
127 return this;
128 }
129
135 {
136 ConfigurationManager.AppSettings["CslaDataPortalActivator"] = typeName;
137 return this;
138 }
139
144 public CslaDataPortalConfiguration Activator(Server.IDataPortalActivator activator)
145 {
146 ApplicationContext.DataPortalActivator = activator;
147 return this;
148 }
149
156 {
157 ConfigurationManager.AppSettings["CslaAuthentication"] = typeName;
158 return this;
159 }
160
167 {
168 ServerAuthorizationProviderType(type.AssemblyQualifiedName);
169 return this;
170 }
171
178 {
179 ConfigurationManager.AppSettings["CslaAuthorizationProvider"] = typeName;
180 return this;
181 }
182
191 {
192 ConfigurationManager.AppSettings["CslaDataPortalInterceptor"] = typeName;
193 return this;
194 }
195
204 {
205 InterceptorType(type.AssemblyQualifiedName);
206 return this;
207 }
208
215 {
216 ExceptionInspectorType(type.AssemblyQualifiedName);
217 return this;
218 }
219
226 {
227 ConfigurationManager.AppSettings["CslaDataPortalExceptionInspector"] = typeName;
228 return this;
229 }
230
239 {
240 FactoryLoaderType(type.AssemblyQualifiedName);
241 return this;
242 }
243
252 {
253 ConfigurationManager.AppSettings["CslaObjectFactoryLoader"] = typeName;
254 return this;
255 }
256
264 {
265 ConfigurationManager.AppSettings["CslaAutoCloneOnUpdate"] = value.ToString();
266 return this;
267 }
268
276 {
277 ConfigurationManager.AppSettings["CslaDataPortalReturnObjectOnException"] = value.ToString();
278 return this;
279 }
280
288 {
289 DashboardType(type.AssemblyQualifiedName);
290 return this;
291 }
292
300 {
301 ConfigurationManager.AppSettings["CslaDashboardType"] = typeName;
303 return this;
304 }
305
316 {
317 ConfigurationManager.AppSettings["CslaFlowSynchronizationContext"] = flow.ToString().ToLower();
318 return this;
319 }
320 }
321}
Use this type to configure the settings for the CSLA .NET data portal.
CslaDataPortalConfiguration ServerAuthorizationProviderType(Type type)
Sets the type name to be used for server-side data portal authorization.
CslaDataPortalConfiguration ActivatorType(string typeName)
Sets the type of the IDataPortalActivator provider.
CslaDataPortalConfiguration ProxyDescriptors(List< Tuple< string, string, string > > descriptors)
Adds resource/type to data portal proxy mappings for use by the data portal.
CslaDataPortalConfiguration FlowSynchronizationContext(bool flow)
Sets a value indicating whether any synchronization context should be flowed to child tasks by LocalP...
CslaDataPortalConfiguration ServerAuthorizationProviderType(string typeName)
Sets the type name to be used for server-side data portal authorization.
CslaDataPortalConfiguration DashboardType(Type type)
Sets the assembly qualified type name of the dashboard, or 'Dashboard' for default,...
CslaDataPortalConfiguration ProxyFactoryType(string typeName)
CslaDataPortalConfiguration AuthenticationType(string typeName)
Sets the authentication type being used by the CSLA .NET framework.
CslaDataPortalConfiguration InterceptorType(Type type)
Sets the type of interceptor invoked by the data portal for pre- and post-processing of each data por...
CslaDataPortalConfiguration InterceptorType(string typeName)
Sets the type of interceptor invoked by the data portal for pre- and post-processing of each data por...
CslaDataPortalConfiguration FactoryLoaderType(string typeName)
Sets the type name of the factor loader used to create server-side instances of business object facto...
CslaDataPortalConfiguration DefaultProxy(string typeName, string defaultUrl)
Configure the default data portal proxy type and URL.
CslaDataPortalConfiguration AutoCloneOnUpdate(bool value)
Sets a value indicating whether objects should be automatically cloned by the data portal Update() me...
CslaDataPortalConfiguration DataPortalReturnObjectOnException(bool value)
Gets or sets a value indicating whether the server-side business object should be returned to the cli...
CslaDataPortalConfiguration ExceptionInspectorType(Type type)
Sets the type of the ExceptionInspector class.
CslaDataPortalConfiguration DashboardType(string typeName)
Sets the assembly qualified type name of the dashboard, or 'Dashboard' for default,...
CslaDataPortalConfiguration FactoryLoaderType(Type type)
Sets the type of the factor loader used to create server-side instances of business object factories ...
CslaDataPortalConfiguration ExceptionInspectorType(string typeName)
Sets the type name of the ExceptionInspector class.
CslaDataPortalConfiguration ProxyFactoryType(Type type)
summary> Sets the full type name (or 'Default') of the data portal proxy factory object to be used to...
CslaDataPortalConfiguration DefaultProxy(Type type, string defaultUrl)
Configure the default data portal proxy type and URL.
CslaDataPortalConfiguration ActivatorType(Type type)
Sets the type of the IDataPortalActivator provider.
CslaDataPortalConfiguration Activator(Server.IDataPortalActivator activator)
Sets an instance of the IDataPortalActivator provider.
Default data portal proxy factory that creates the IDataPortalProxy instance to use for the DataPorta...
static void AddDescriptor(Type objectType, DataPortalProxyDescriptor descriptor)
Add a proxy descriptor for the specified root business type.