예제 #1
0
        public NoteRepository(INoteContext noteContext, IMapToExisting<Note, Note> noteMapper)
        {
            Check.If(noteContext).IsNotNull();
            Check.If(noteMapper).IsNotNull();

            _noteContext = noteContext;
            _noteMapper = noteMapper;
        }
예제 #2
0
        public NotesRepository(INoteContext context)
        {
            this.context = context;

            if (!(this.context.Notes.CountDocuments(_ => true) > 0))
            {
                var note = new Note()
                {
                    Title   = "Test",
                    Content = "Lorem ipsum dolor sit amet, consectetur adipiscing elit. Suspendisse ultrices vel odio ac porttitor. Sed vel posuere enim, ac elementum lectus. Nam eget tincidunt nisl. Proin ut arcu auctor, ornare mauris id, malesuada diam. Quisque bibendum suscipit ullamcorper. Vestibulum eget varius tortor, lacinia suscipit erat. Mauris luctus lacus odio, non euismod lectus cursus id. Etiam molestie diam mi, id gravida lectus auctor in. Praesent venenatis blandit maximus. Pellentesque commodo augue quis erat efficitur elementum. Sed vitae convallis tellus. Aenean eu orci sed ante molestie dapibus ut vel lacus. Morbi massa orci, commodo in tellus eget, efficitur vehicula est. Phasellus varius condimentum nisi, nec luctus tortor cursus id. Sed bibendum dui sit amet nisi interdum pretium. Sed in odio mauris."
                };

                this.context.Notes.InsertOne(note);
            }
        }
예제 #3
0
        public DatabaseFixture()
        {
            var builder = new ConfigurationBuilder().AddJsonFile("appsettings.json");

            configuration = builder.Build();
            context       = new NoteContext(configuration);
            context.Notes.DeleteMany(Builders <NoteUser> .Filter.Empty);
            context.Notes.InsertMany(new List <NoteUser>
            {
                new NoteUser {
                    UserId = "Mukesh", Notes = new List <Note> {
                        new Note {
                            Id = 101, Category = new Category {
                                Id = 101, Name = "Sports", CreatedBy = "Mukesh", Description = "All about sports", CreationDate = new DateTime()
                            },
                            Content = "Sample Note", CreatedBy = "Mukesh", Reminders = new List <Reminder> {
                                new Reminder {
                                    Id = 201, Name = "Sports", CreatedBy = "Mukesh", Description = "sports reminder", CreationDate = new DateTime(), Type = "email"
                                }
                            },
                            Title = "Sample", CreationDate = new DateTime()
                        }
                    }
                },

                new NoteUser {
                    UserId = "Sachin", Notes = new List <Note> {
                        new Note {
                            Id = 141, Category = new Category {
                                Id = 102, Name = "Sports", CreatedBy = "Sachin", Description = "All about sports", CreationDate = new DateTime()
                            },
                            Content = "Sample Note", CreatedBy = "Sachin", Reminders = new List <Reminder> {
                                new Reminder {
                                    Id = 202, Name = "Sports", CreatedBy = "Sachin", Description = "sports reminder", CreationDate = new DateTime(), Type = "email"
                                }
                            },
                            Title = "Sample", CreationDate = new DateTime()
                        }
                    }
                }
            });
        }
예제 #4
0
 public NotesController(INoteContext context)
 {
     this.context = context;
 }
예제 #5
0
 public NoteRepository(INoteContext notesDbContext)
 {
     _notesDbContext = notesDbContext;
 }
예제 #6
0
 public UserRepository(INoteContext context) : base(context)
 {
 }
예제 #7
0
 public NoteRepository(IOptions <Settings> settings, INoteContext context)
 {
     _context = context;
 }
예제 #8
0
 public void Dispose()
 {
     context = null;
 }
 //define a private variable to represent NoteContext
 public NoteRepository(INoteContext _context)
 {
     context = _context;
 }
 public NoteRepository(INoteContext context)
 {
     _context = context;
 }