Exemplo n.º 1
0
 /// <summary>
 /// Add Cosmos Logging for NHibernate
 /// </summary>
 /// <param name="sf"></param>
 /// <exception cref="ArgumentNullException"></exception>
 public static void UseCosmosLogging(this ISessionFactory sf)
 {
     if (sf is null)
     {
         throw new ArgumentNullException(nameof(sf));
     }
     sf.WithOptions().Interceptor(LoggingInterceptorManager.Get());
 }
Exemplo n.º 2
0
        /// <summary>
        /// Add Cosmos Logging for NHibernate
        /// </summary>
        /// <param name="sf"></param>
        /// <param name="interceptors"></param>
        /// <exception cref="ArgumentNullException"></exception>
        public static void UseCosmosLogging(this ISessionFactory sf, IInterceptor[] interceptors)
        {
            if (sf is null)
            {
                throw new ArgumentNullException(nameof(sf));
            }
            if (interceptors is null)
            {
                throw new ArgumentNullException(nameof(interceptors));
            }
            var builder = sf.WithOptions().Interceptor(LoggingInterceptorManager.Get());

            for (var i = 0; i < interceptors.Length; i++)
            {
                builder.Interceptor(interceptors[i]);
            }
        }