public static ConnectionServiceProvider ToConnectionServiceProvider(this IConnectionService ics)
        {
            if (ics is ConnectionServiceProvider)
            {
                return(ics as ConnectionServiceProvider);
            }

            ConnectionServiceProxy    csproxy    = ics as ConnectionServiceProxy;
            ConnectionServiceProvider csprovider = Reflector.GetInstanceFieldByName(csproxy, "m_RealConnectionService", ReflectionWays.SystemReflection) as ConnectionServiceProvider;

            return(csprovider);
        }
Beispiel #2
0
        public static ConnectionServiceProvider GetConnectionServiceProvider(this ICoreObject coreObject)
        {
            ConnectionServiceProvider connectionService = null;

            if (!coreObject.IsDeleted || !coreObject.IsDeleting)
            {
                IConnectionService ics = ((IDlc)coreObject.Context).WorkingContext.DlcManager.Load("Siemens.Automation.DomainServices.ConnectionService")
                                         as IConnectionService;
                ConnectionServiceProxy csp = ics as ConnectionServiceProxy;
                connectionService = Reflector.GetInstancePropertyByName(csp, "RealConnectionService", ReflectionWays.SystemReflection) as ConnectionServiceProvider;
            }
            return(connectionService);
        }