Ejemplo n.º 1
0
        public static void Initialize(NoteContext context)
        {
            context.Database.EnsureCreated();

            if (context.Notes.Any())
            {
                return;
            }

            var notes = new Note[]
            {
                new Note {
                    Content = "Test database", Author = "Pham Trung Truong"
                },
                new Note {
                    Content = "Test database", Author = "Pham Trung Truong"
                },
                new Note {
                    Content = "Test database", Author = "Pham Trung Truong"
                },
                new Note {
                    Content = "Test database", Author = "Pham Trung Truong"
                },
                new Note {
                    Content = "Test database", Author = "Pham Trung Truong"
                },
            };

            foreach (Note n in notes)
            {
                context.Notes.Add(n);
            }
            context.SaveChanges();
        }
Ejemplo n.º 2
0
 public SQLNoteRepository(NoteContext context)
 {
     this.context = context;
 }