Beispiel #1
0
        public void ExecuteCommand <TService>(Action <TService> command) where TService : class, IServiceContract
        {
            var proxy = WcfProxyFactory.CreateProxy <TService>();

            SetCredential <TService>(proxy);
            try
            {
                command.Invoke(proxy.WcfChannel);
                proxy.Close();
            }
            catch (Exception)
            {
                proxy.Abort();
                throw;
            }
        }
Beispiel #2
0
        public TResult ExecuteSimpleCommand <TService, TResult>(Func <TService, TResult> command)
            where TService : class, IServiceContract
        {
            var proxy = WcfProxyFactory.CreateProxy <TService>();

            SetCredential <TService>(proxy);

            try
            {
                var result = command.Invoke(proxy.WcfChannel);
                proxy.Close();
                return(result);
            }
            catch (Exception)
            {
                proxy.Abort();
                throw;
            }
        }