コード例 #1
0
        public PersonController(SampleODataDbContext sampleODataDbContext)
        {
            _sampleODataDbContext = sampleODataDbContext;

            _sampleODataDbContext.Persons.Add(new Person {
                Name = "Bob", Age = 30
            });
            _sampleODataDbContext.Persons.Add(new Person {
                Name = "Tom", Age = 30
            });
            _sampleODataDbContext.Persons.Add(new Person {
                Name = "Rob", Age = 33
            });
            _sampleODataDbContext.Persons.Add(new Person {
                Name = "Tim", Age = 21
            });
            _sampleODataDbContext.Persons.Add(new Person {
                Name = "Joe", Age = 45
            });
            _sampleODataDbContext.Persons.Add(new Person {
                Name = "Bart", Age = 38
            });
            _sampleODataDbContext.Persons.Add(new Person {
                Name = "Zoe", Age = 22
            });
            _sampleODataDbContext.SaveChanges();
        }
コード例 #2
0
        public PersonController(SampleODataDbContext sampleODataDbContext)
        {
            SampleODataDbContext =
                sampleODataDbContext ??
                throw new ArgumentNullException(nameof(sampleODataDbContext));

            SampleODataDbContext.Database.EnsureCreated();
        }
コード例 #3
0
 public PersonController(SampleODataDbContext sampleODataDbContext)
 {
     _sampleODataDbContext = sampleODataDbContext;
 }