public void Seed() { if (!dbContext.Clients.Any()) { var client = new Domain.Entities.Client() { API = "[email protected]:zKR4gkYNHP5tvH".ToBasicAuth(), Authority = new Agent() { Account = new Account() { Name = "Sample Client", HomePage = new Uri("https://bitflipping.net") } }.ToJson(), Name = "Sample Client", Scopes = new List <string> { "all" }, Enabled = true, CreatedAt = DateTimeOffset.UtcNow, UpdatedAt = DateTimeOffset.UtcNow }; dbContext.Clients.Add(client); dbContext.SaveChanges(); } }
public static DoctrinaDbContext Create() { var options = new DbContextOptionsBuilder <DoctrinaDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var context = new DoctrinaDbContext(options); context.Database.EnsureCreated(); var activityId = new Iri("http://www.example.com/activityId/hashset"); context.Activities.Add(new ActivityEntity() { Id = activityId.ToString(), Hash = activityId.ComputeHash() }); context.Agents.AddRange(new AgentEntity[] { AgentsTestFixture.JamesCampbell(), AgentsTestFixture.JosephinaCampbell() }); context.SaveChanges(); return(context); }
public static DoctrinaDbContext Create() { var options = new DbContextOptionsBuilder <DoctrinaDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var context = new DoctrinaDbContext(options); context.Database.EnsureCreated(); // TODO: Parse statements from file, and map to entities. //var collection = new StatementCollection(); context.SaveChanges(); return(context); }
public static DoctrinaDbContext Create() { var options = new DbContextOptionsBuilder <DoctrinaDbContext>() .UseInMemoryDatabase(Guid.NewGuid().ToString()) .Options; var context = new DoctrinaDbContext(options); context.Database.EnsureCreated(); //context.Statements.AddRange(new[] { //}); context.SaveChanges(); return(context); }