Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Seed Data Sort

$
0
0

Hi folks,

I have created Seed data as below:

        var subModules = new SubModule[]
            {
                new SubModule{ ModuleID=1, Name="***" },
                new SubModule{ ModuleID=1, Name="***" },
                new SubModule{ ModuleID=1, Name="***" },
                new SubModule{ ModuleID=2, Name="***" },
                new SubModule{ ModuleID=2, Name="***" },
                new SubModule{ ModuleID=2, Name="***" },
                new SubModule{ ModuleID=2, Name="***" },
                new SubModule{ ModuleID=2, Name="***" },
                new SubModule{ ModuleID=2, Name="***" },
                new SubModule{ ModuleID=3, Name="***" },
                new SubModule{ ModuleID=3, Name="***" },
                new SubModule{ ModuleID=3, Name="***" },
                new SubModule{ ModuleID=3, Name="***" },
                new SubModule{ ModuleID=3, Name="***" },
                new SubModule{ ModuleID=3, Name="***" },
                new SubModule{ ModuleID=4, Name="***" },
                new SubModule{ ModuleID=4, Name="***" },
                new SubModule{ ModuleID=4, Name="***" },
                new SubModule{ ModuleID=5, Name="***" },
                new SubModule{ ModuleID=5, Name="***" },
                new SubModule{ ModuleID=5, Name="***" },
                new SubModule{ ModuleID=5, Name="***" },
                new SubModule{ ModuleID=6, Name="***" },
                new SubModule{ ModuleID=6, Name="***" },
                new SubModule{ ModuleID=6, Name="***" },
				........
            };

            foreach (SubModule item in subModules)
            {
                context.SubModules.Add(item);
            }
            context.SaveChanges();



After run the project, It goes into a table. It seems ok but i want sort (Ascending order) of module id. Any idea?
I am waiting for your response.
Thanks in Advance!


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>