Exemplo n.º 1
0
        /// <summary>
        /// Creates a task to generate a compiled saga factory method that is faster than the
        /// regular Activator, but doing this asynchronously ensures we don't slow down startup
        /// </summary>
        /// <returns></returns>
        async Task GeneratePropertyFactoryMethodAsynchronously()
        {
            await Task.Yield();

            try
            {
                var factory = new PropertySagaInstanceFactory <TSaga>();

                Interlocked.Exchange(ref _factoryMethod, factory.FactoryMethod);
            }
            catch (Exception ex)
            {
                LogContext.Error?.Log(ex, "Generate property instance factory faulted: {SagaType}", TypeMetadataCache <TSaga> .ShortName);
            }
        }
Exemplo n.º 2
0
        /// <summary>
        /// Creates a task to generate a compiled saga factory method that is faster than the
        /// regular Activator, but doing this asynchronously ensures we don't slow down startup
        /// </summary>
        /// <returns></returns>
        async Task GeneratePropertyFactoryMethodAsynchronously()
        {
            await Task.Yield();

            try
            {
                var factory = new PropertySagaInstanceFactory <TSaga>();

                Interlocked.Exchange(ref _factoryMethod, factory.FactoryMethod);
            }
            catch (Exception ex)
            {
                if (_log.IsErrorEnabled)
                {
                    _log.Error($"Failed to generate property instance factory for {TypeMetadataCache<TSaga>.ShortName}", ex);
                }
            }
        }