- Mark as New
- Bookmark
- Subscribe
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
‎Aug 06, 2024 10:56 AM
Hai,
I am trying to connect Airtable in .net maui. I installed Airtable 1.4.0 ,AirtableEfcore 1.1.0 and CData.Airtable.EntityFrameworkCore. This is my code
public class TestDbContext : DbContext
{
public TestDbContext(DbContextOptions options) : base(options)
{
}
public DbSet<Student> Master { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
}
}
public class Student
{
public string Id { get; set; }
public string Name { get; set; }
}
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
var services = new ServiceCollection();
services.AddDbContext<TestDbContext>(o => o.UseAirtable("app66666Xep", "patSOBFs83Vv6"));
var sp = services.BuildServiceProvider();
var scope = sp.CreateScope();
var db = scope.ServiceProvider.GetRequiredService<TestDbContext>();
TestDbContext Db;
var x = db.Master.ToList();
}
But I could not get a connection Services is null.
Please help how to get connected.
Thanks
