Example #1
0
        static public void CreateData(FierceStukCloudDbContext context)
        {
            PlayLists = PlayListsFactory();
            Authors   = AuthorsFactory();

            context.PlayLists.AddRange(PlayLists.AsEnumerable());
            context.Authors.AddRange(Authors.AsEnumerable());
            context.SaveChanges();

            var s1 = new Song()
            {
                Id = Guid.NewGuid(), Title = "title0"
            };

            s1.Authors.Add(Authors[0]);
            //s1.DbAuthors = new List<SongAuthor>()
            //{
            //    SongAuthorFactory(s1.Id, Authors[0].Id)
            //};


            var s2 = new Song()
            {
                Id = Guid.NewGuid(), Title = "title2"
            };

            s2.Authors.Add(Authors[0]);
            //s2.DbAuthors = new List<SongAuthor>()
            //{
            //    SongAuthorFactory(s2.Id, Authors[0].Id)
            //};

            Songs = new List <Song>();
            Songs.Add(s1);
            Songs.Add(s2);

            //PlayLists[0].DbSongs.Add(new SongPlayList() { Place = 0, PlayListId = PlayLists[0].Id, SongId = Songs[0].Id });
            PlayLists[0].Songs.Add(Songs[0]);

            context.Songs.Add(s1);
            context.Songs.Add(s2);
            context.SaveChanges();
        }