Exemple #1
0
        /// <summary>
        /// Returns a list of all the Saga classes in the provided assemblies.
        /// </summary>
        /// <param name="assemblies">The assemblies to scan</param>
        /// <returns>List of Types that implement <see cref="ISaga{TSagaData}"/></returns>
        public static IEnumerable <Type> GetAllSagaTypes(IEnumerable <Assembly> assemblies)
        {
            var allSagaTypes = assemblies.SelectMany(a => a.GetTypes())
                               .Where(t => NSagaReflection.TypeImplementsInterface(t, typeof(ISaga <>)))
                               .Where(t => t.IsClass)
                               .ToList();

            return(allSagaTypes);
        }
Exemple #2
0
        /// <summary>
        /// Returns a list of all the Saga classes in the provided assemblies.
        /// </summary>
        /// <param name="assemblies">The assemblies to scan</param>
        /// <returns>List of Types that implement <see cref="ISaga{TSagaData}"/></returns>
        public static IEnumerable <Type> GetAllSagaTypes(IEnumerable <Assembly> assemblies)
        {
            try
            {
                var types = assemblies.SelectMany(a => a.GetTypes()).ToList();

                var allSagaTypes = types
                                   .Where(t => NSagaReflection.TypeImplementsInterface(t, typeof(ISaga <>)))
                                   .Where(t => t.IsClass)
                                   .ToList();

                return(allSagaTypes);
            }
            catch (ReflectionTypeLoadException ex)
            {
                //Display or log the error based on your application.

                throw new Exception(BuildFusionException(ex));
            }
        }