CSLA.NET 6.0.0
CSLA .NET is a software development framework that helps you build a reusable, maintainable object-oriented business layer for your app.
ServiceClientManager.cs
Go to the documentation of this file.
1#if !NETSTANDARD2_0 && !NET5_0 && !NET6_0
2//-----------------------------------------------------------------------
3// <copyright file="ServiceClientManager.cs" company="Marimer LLC">
4// Copyright (c) Marimer LLC. All rights reserved.
5// Website: https://cslanet.com
6// </copyright>
7// <summary>Provides an automated way to reuse </summary>
8//-----------------------------------------------------------------------
9using System;
10
11namespace Csla.Data
12{
24 [Obsolete("Use dependency injection", false)]
25 public class ServiceClientManager<C, T> : Core.IUseApplicationContext
26 where C : System.ServiceModel.ClientBase<T>
27 where T : class
28 {
29 private static object _lock = new object();
30 private C _client;
31 private string _name = string.Empty;
32
33 ApplicationContext Core.IUseApplicationContext.ApplicationContext { get => ApplicationContext; set => ApplicationContext = value; }
34 private ApplicationContext ApplicationContext { get; set; }
35
43 {
44
45 lock (_lock)
46 {
48 if (mgr == null)
49 {
50 mgr = new ServiceClientManager<C, T>(name);
52 }
53 return mgr;
54 }
55 }
56
57
58 private ServiceClientManager(string name)
59 {
60 _client = (C)(ApplicationContext.CreateInstanceDI(typeof(C)));
61 }
62
66 public C Client
67 {
68 get
69 {
70 return _client;
71 }
72 }
73 }
74}
75#endif
Provides consistent context information between the client and server DataPortal objects.
object CreateInstanceDI(Type objectType, params object[] parameters)
Creates an object using 'Activator.CreateInstance' using service provider (if one is available) to po...
ApplicationContext(ApplicationContextAccessor applicationContextAccessor)
Creates a new instance of the type
ContextDictionary LocalContext
Returns the application-specific context data that is local to the current AppDomain.
Provides an automated way to reuse a service client proxy objects within the context of a single data...
ServiceClientManager< C, T > GetManager(string name)
Gets the client proxy object for the specified name.
C Client
Gets a reference to the current client proxy object.