public U GenericFunc <T, U, V>(T a, U b, V c)
            where U : struct
            where V : class
        {
            LogMethodEntry          e;
            ServiceLogMethodOptions o = GetLoggerForRunningCall(10, out e);

            if ((o & ServiceLogMethodOptions.LogParameters) != 0)
            {
                e._parameters = new object[] { a, b, c }
            }
            ;
            try
            {
                return(StandardHandleLogReturn(o, e, _impl.GenericFunc(a, b, c)));
            }
            catch (Exception ex)
            {
                if ((o & ServiceLogMethodOptions.LogError) != 0)
                {
                    OnCallException(10, ex, e);
                }
                throw;
            }
        }

        #region event EventHandler<SpecEventArgs> AnEventGen
        Delegate _dAnEventGen;
        EventHandler <SpecEventArgs> _hookAnEventGen;
        public void GenericFunc <T>(T a)
        {
            LogMethodEntry          e;
            ServiceLogMethodOptions o = GetLoggerForRunningCall(9, out e);

            if ((o & ServiceLogMethodOptions.LogParameters) != 0)
            {
                e._parameters = new object[] { a }
            }
            ;
            try
            {
                _impl.GenericFunc(a);
                if ((o & ServiceLogMethodOptions.Leave) != 0)
                {
                    LogEndCall(e);
                }
            }
            catch (Exception ex)
            {
                if ((o & ServiceLogMethodOptions.LogError) != 0)
                {
                    OnCallException(9, ex, e);
                }
                throw;
            }
        }
 public void SetConfiguration( PropertyInfo p, ServiceLogMethodOptions option )
 {
     MethodInfo mG = p.GetGetMethod();
     if( mG != null ) SetConfiguration( mG, option );
     MethodInfo mS = p.GetSetMethod();
     if( mS != null ) SetConfiguration( mS, option );
 }
Esempio n. 4
0
        /// <summary>
        /// Called when a method is entered.
        /// </summary>
        /// <param name="m"></param>
        /// <param name="logOptions"></param>
        /// <returns></returns>
        internal LogMethodEntry LogMethodEnter(MethodInfo m, ServiceLogMethodOptions logOptions)
        {
            Debug.Assert(logOptions != 0);
            LogMethodEntry me = new LogMethodEntry();

            if ((logOptions & ServiceLogMethodOptions.Leave) == 0)
            {
                me.InitClose(++_nextLSN, _currentDepth, m);
                // Emits the "Created" event.
                EventHandler <LogEventArgs> h = EventCreated;
                if (h != null)
                {
                    h(_eventSender, me);
                }
            }
            else
            {
                me.InitOpen(++_nextLSN, _currentDepth++, m);
                // Emits the "Creating" event.
                EventHandler <LogEventArgs> h = EventCreating;
                if (h != null)
                {
                    h(_eventSender, me);
                }
            }
            return(me);
        }
Esempio n. 5
0
 public void SetAllMethodsConfiguration(Type type, ServiceLogMethodOptions option)
 {
     foreach (var m in CK.Reflection.ReflectionHelper.GetFlattenMethods(type).Where(m => !m.IsSpecialName))
     {
         _methods[m] = option;
     }
 }
Esempio n. 6
0
 public void SetAllPropertiesConfiguration(Type type, ServiceLogMethodOptions option)
 {
     foreach (var p in CK.Reflection.ReflectionHelper.GetFlattenProperties(type))
     {
         SetConfiguration(p, option);
     }
 }
Esempio n. 7
0
 public void SetMethodGroupConfiguration(Type type, string methodName, ServiceLogMethodOptions option)
 {
     foreach (var m in CK.Reflection.ReflectionHelper.GetFlattenMethods(type).Where(m => m.Name == methodName))
     {
         _methods[m] = option;
     }
 }
 public void SetMethodGroupConfiguration( Type type, string methodName, ServiceLogMethodOptions option )
 {
     foreach( var m in CK.Reflection.ReflectionHelper.GetFlattenMethods( type ).Where( m => m.Name == methodName ) )
     {
         _methods[m] = option;
     }
 }
 public void SetAllMethodsConfiguration( Type type, ServiceLogMethodOptions option )
 {
     foreach( var m in CK.Reflection.ReflectionHelper.GetFlattenMethods( type ).Where( m => !m.IsSpecialName ) )
     {
         _methods[m] = option;
     }
 }
 public object this[int i]
 {
     get
     {
         LogMethodEntry          e;
         ServiceLogMethodOptions o = GetLoggerForRunningCall(6, out e);
         if ((o & ServiceLogMethodOptions.LogParameters) != 0)
         {
             e._parameters = new object[] { i }
         }
         ;
         try
         {
             return(StandardHandleLogReturn(o, e, _impl[i]));
         }
         catch (Exception ex)
         {
             if ((o & ServiceLogMethodOptions.LogError) != 0)
             {
                 OnCallException(6, ex, e);
             }
             throw;
         }
     }
 }
Esempio n. 11
0
        public void SetLogOptions(string methodName, ServiceLogMethodOptions opt)
        {
            MethodInfo m = typeof(IChoucrouteService).GetMethod(methodName);

            Assert.That(m, Is.Not.Null);
            SetLogOptions(m, opt);
        }
Esempio n. 12
0
        protected ServiceLogMethodOptions GetLoggerForAnyCall(int iMethodMRef, out LogMethodEntry logger)
        {
            MEntry me = _mRefs[iMethodMRef];
            ServiceLogMethodOptions o = me.LogOptions;

            logger = o == ServiceLogMethodOptions.None ? null : _serviceHost.LogMethodEnter(me.Method, o);
            return(o);
        }
Esempio n. 13
0
 public LogMethodConfig( string methodName, string returnType, List<ILogParameterInfo> p, ServiceLogMethodOptions logOptions, bool doLog )
 {
     _doLog = doLog;
     LogOptions = logOptions;
     Name = methodName;
     ReturnType = returnType;
     _parameters = p;
     _parametersEx = new CKReadOnlyListOnIList<ILogParameterInfo>( _parameters );
 }
Esempio n. 14
0
        protected ServiceLogMethodOptions GetLoggerForNotDisabledCall(int iMethodMRef, out LogMethodEntry logger)
        {
            if (_impl == null || _impl.Status == RunningStatus.Disabled)
            {
                throw new ServiceNotAvailableException(_typeInterface);
            }
            MEntry me = _mRefs[iMethodMRef];
            ServiceLogMethodOptions o = me.LogOptions;

            o     &= ServiceLogMethodOptions.CreateEntryMask;
            logger = o == ServiceLogMethodOptions.None ? null : _serviceHost.LogMethodEnter(me.Method, o);
            return(o);
        }
Esempio n. 15
0
 public void SetLogOptions(MethodInfo method, ServiceLogMethodOptions opt)
 {
     MEntry[] _mRefs = ServiceProxyBase.MethodEntries;
     for (int i = 0; i < _mRefs.Length; ++i)
     {
         if (_mRefs[i].Method == method)
         {
             _mRefs[i].LogOptions = opt;
             return;
         }
     }
     Assert.Fail("Unknown Method");
 }
 public string this[int i, DateTime d, IDynamicService s, string t, object ob, double f, byte b]
 {
     get
     {
         LogMethodEntry          e;
         ServiceLogMethodOptions o = GetLoggerForRunningCall(7, out e);
         if ((o & ServiceLogMethodOptions.LogParameters) != 0)
         {
             e._parameters = new object[] { i, d, s, t, ob, f, b }
         }
         ;
         try
         {
             return(StandardHandleLogReturn(o, e, _impl[i, d, s, t, ob, f, b]));
         }
         catch (Exception ex)
         {
             if ((o & ServiceLogMethodOptions.LogError) != 0)
             {
                 OnCallException(7, ex, e);
             }
             throw;
         }
     }
     set
     {
         LogMethodEntry          e;
         ServiceLogMethodOptions o = GetLoggerForRunningCall(8, out e);
         if ((o & ServiceLogMethodOptions.LogParameters) != 0)
         {
             e._parameters = new object[] { i, d, s, t, o, f, b }
         }
         ;
         try
         {
             _impl[i, d, s, t, o, f, b] = value;
             if ((o & ServiceLogMethodOptions.Leave) != 0)
             {
                 LogEndCall(e);
             }
         }
         catch (Exception ex)
         {
             if ((o & ServiceLogMethodOptions.LogError) != 0)
             {
                 OnCallException(8, ex, e);
             }
             throw;
         }
     }
 }
Esempio n. 17
0
        public void SetConfiguration(PropertyInfo p, ServiceLogMethodOptions option)
        {
            MethodInfo mG = p.GetGetMethod();

            if (mG != null)
            {
                SetConfiguration(mG, option);
            }
            MethodInfo mS = p.GetSetMethod();

            if (mS != null)
            {
                SetConfiguration(mS, option);
            }
        }
 T StandardHandleLogReturn <T>(ServiceLogMethodOptions o, LogMethodEntry e, T retValue)
 {
     if ((o & ServiceLogMethodOptions.Leave) != 0)
     {
         if ((o & ServiceLogMethodOptions.LogReturnValue) != 0)
         {
             LogEndCallWithValue(e, retValue);
         }
         else
         {
             LogEndCall(e);
         }
     }
     return(retValue);
 }
Esempio n. 19
0
 private void ApplyConfiguration(ServiceProxyBase proxy)
 {
     for (int i = 0; i < proxy.MethodEntries.Length; ++i)
     {
         ServiceLogMethodOptions o = ServiceLogMethodOptions.None;
         foreach (IServiceHostConfiguration cfg in _configurations)
         {
             o |= cfg.GetOptions(proxy.MethodEntries[i].Method);
         }
         proxy.MethodEntries[i].LogOptions = o;
     }
     for (int i = 0; i < proxy.EventEntries.Length; ++i)
     {
         ServiceLogEventOptions o = ServiceLogEventOptions.None;
         foreach (IServiceHostConfiguration cfg in _configurations)
         {
             o |= cfg.GetOptions(proxy.EventEntries[i].Event);
         }
         proxy.EventEntries[i].LogOptions = o;
     }
 }
        public void RaiseAnEventGen()
        {
            LogMethodEntry          e;
            ServiceLogMethodOptions o = GetLoggerForRunningCall(11, out e);

            try
            {
                _impl.RaiseAnEventGen();
                if ((o & ServiceLogMethodOptions.Leave) != 0)
                {
                    LogEndCall(e);
                }
            }
            catch (Exception ex)
            {
                if ((o & ServiceLogMethodOptions.LogError) != 0)
                {
                    OnCallException(11, ex, e);
                }
                throw;
            }
        }
        public void CallFunc()
        {
            LogMethodEntry          e;
            ServiceLogMethodOptions o = GetLoggerForRunningCall(0, out e);

            try
            {
                _impl.CallFunc();
                if ((o & ServiceLogMethodOptions.Leave) != 0)
                {
                    LogEndCall(e);
                }
            }
            catch (Exception ex)
            {
                if ((o & ServiceLogMethodOptions.LogError) != 0)
                {
                    OnCallException(0, ex, e);
                }
                throw;
            }
        }
        public int Div(int i, int j, int k)
        {
            LogMethodEntry          e;
            ServiceLogMethodOptions o = GetLoggerForRunningCall(2, out e);

            if ((o & ServiceLogMethodOptions.LogParameters) != 0)
            {
                e._parameters = new object[] { i, j, k }
            }
            ;
            try
            {
                return(StandardHandleLogReturn(o, e, _impl.Div(i, j, k)));
            }
            catch (Exception ex)
            {
                if ((o & ServiceLogMethodOptions.LogError) != 0)
                {
                    OnCallException(2, ex, e);
                }
                throw;
            }
        }
        public int Div(int i, int j)
        {
            // This one has IgnoreServiceRunningStatus attribute.
            LogMethodEntry          e;
            ServiceLogMethodOptions o = GetLoggerForNotDisabledCall(1, out e);

            if ((o & ServiceLogMethodOptions.LogParameters) != 0)
            {
                e._parameters = new object[] { i, j }
            }
            ;
            try
            {
                return(StandardHandleLogReturn(o, e, _impl.Div(i, j)));
            }
            catch (Exception ex)
            {
                if ((o & ServiceLogMethodOptions.LogError) != 0)
                {
                    OnCallException(1, ex, e);
                }
                throw;
            }
        }
Esempio n. 24
0
 private void ProcessLogOptions( ServiceLogMethodOptions logOptions )
 {
     DoLogErrors =       ((logOptions & ServiceLogMethodOptions.LogError) == ServiceLogMethodOptions.LogError);
     DoLogEnter =        ((logOptions & ServiceLogMethodOptions.Enter) == ServiceLogMethodOptions.Enter);
     DoLogParameters =   ((logOptions & ServiceLogMethodOptions.LogParameters) == ServiceLogMethodOptions.LogParameters);
     DoLogCaller =       ((logOptions & ServiceLogMethodOptions.LogCaller) == ServiceLogMethodOptions.LogCaller);
     DoLogLeave =        ((logOptions & ServiceLogMethodOptions.Leave) == ServiceLogMethodOptions.Leave);
     DoLogReturnValue =  ((logOptions & ServiceLogMethodOptions.LogReturnValue) == ServiceLogMethodOptions.LogReturnValue);
 }
 public void SetAllPropertiesConfiguration( Type type, ServiceLogMethodOptions option )
 {
     foreach( var p in CK.Reflection.ReflectionHelper.GetFlattenProperties( type ) ) SetConfiguration( p, option );
 }
Esempio n. 26
0
 public void SetConfiguration(MethodInfo m, ServiceLogMethodOptions option)
 {
     _methods[m] = option;
 }
Esempio n. 27
0
 public void SetLogOptions( MethodInfo method, ServiceLogMethodOptions opt )
 {
     MEntry[] _mRefs = ServiceProxyBase.MethodEntries;
     for( int i = 0; i < _mRefs.Length; ++i )
         if( _mRefs[i].Method == method )
         {
             _mRefs[i].LogOptions = opt;
             return;
         }
     Assert.Fail( "Unknown Method" );
 }
Esempio n. 28
0
 public void SetLogOptions( string methodName, ServiceLogMethodOptions opt )
 {
     MethodInfo m = typeof( IChoucrouteService ).GetMethod( methodName );
     Assert.That( m, Is.Not.Null );
     SetLogOptions( m, opt );
 }
 public void SetConfiguration( MethodInfo m, ServiceLogMethodOptions option )
 {
     _methods[m] = option;
 }