-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathProgram.cs
40 lines (31 loc) · 998 Bytes
/
Program.cs
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
using Microsoft.EntityFrameworkCore;
using Newtonsoft.Json.Linq;
static class Program
{
public static async Task Main(string[] args)
{
var builder = WebApplication.CreateBuilder(args);
builder.Services
.AddDbContext<MyDbContext>(
options => options.UseCosmos(
"does not matter",
"does not matter"
)
)
.AddControllers();
var app = builder.Build();
await RunAsync(app.Services);
app.MapControllers();
app.Run();
}
public static async Task RunAsync(IServiceProvider services)
{
using (var scope = services.CreateScope())
{
var context = scope.ServiceProvider.GetRequiredService<MyDbContext>();
//MyModel myModel = new MyModel() { Data = new JArray() };
await context.AddAsync(new JArray());
//await context.MyModels.AddAsync(myModel);
}
}
}