Beispiel #1
0
        private static SeedingPlan GetSeedingPlanFor(SeedAssembly seedAssembly, ISeedingSetup seedingSetup)
        {
            Assert(seedAssembly != null);

            var seedInfoTree = SeedInfoTree.Create(seedAssembly.SeedTypes);

            var seedingSteps = new List <SeedInfo>();

            foreach (var seedInfo in seedInfoTree.AllSeeds)
            {
                RecursivelyBuildSeedingSteps(seedInfo);
            }

            return(new SeedingPlan(seedingSetup, seedAssembly.SeedingSetupType, seedingSteps));

            void RecursivelyBuildSeedingSteps(SeedInfo seedInfo)
            {
                if (seedingSteps.Contains(seedInfo))
                {
                    return;
                }

                foreach (var dependency in seedInfo.DependsOn)
                {
                    RecursivelyBuildSeedingSteps(dependency);
                }

                seedingSteps.Add(seedInfo);
            }
        }
Beispiel #2
0
        public SeedInfoTree GetSeedInfoTree(Assembly assembly, IEnumerable <string> seedFilters)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }

            return(GetSeedInfoTreeImpl());

            SeedInfoTree GetSeedInfoTreeImpl()
            {
                var seedAssembly = SeedAssembly.Create(assembly, seedFilters);

                return(SeedInfoTree.Create(seedAssembly.SeedTypes));
            }
        }
Beispiel #3
0
        public IEnumerable <SeedInfo> GetSeedsFor(Assembly assembly, IEnumerable <string> seedFilters)
        {
            if (assembly == null)
            {
                throw new ArgumentNullException(nameof(assembly));
            }

            return(GetSeedInfosImpl());

            IEnumerable <SeedInfo> GetSeedInfosImpl()
            {
                var seedAssembly = SeedAssembly.Create(assembly, seedFilters);

                return(SeedInfoTree.Create(seedAssembly.SeedTypes)
                       .AllSeeds
                       .Where(seedInfo => seedAssembly.SeedTypes.Contains(seedInfo.SeedType)));
            }
        }