Airtable.EFCore
0.2.5.4
See the version list below for details.
dotnet add package Airtable.EFCore --version 0.2.5.4
NuGet\Install-Package Airtable.EFCore -Version 0.2.5.4
<PackageReference Include="Airtable.EFCore" Version="0.2.5.4" />
paket add Airtable.EFCore --version 0.2.5.4
#r "nuget: Airtable.EFCore, 0.2.5.4"
// Install Airtable.EFCore as a Cake Addin #addin nuget:?package=Airtable.EFCore&version=0.2.5.4 // Install Airtable.EFCore as a Cake Tool #tool nuget:?package=Airtable.EFCore&version=0.2.5.4
Airtable.EFCore
Entity Framework Core provider for Airtable.
Uses Airtable.Net library by ngocnicholas.
Based and inspired mostly by Cosmos DB provider by Microsoft.
State of the project and motivation
This project was created to support charity operations of UA Responders charity that runs it's internal operations on Airtable and Azure Functions.
Because Airtable is a good simple UI and database, but lacks good automation facilities, we run some of our automations on Azure Functions in C#.
Currently all operations on Azure Functions are ported to work on top of this provider, and features added are based on needs to support those operations.
Only small subset of LINQ is translated, but there is a foundation to add features as needed.
Changetracking and SaveChangesAsync()
works, so you can do full CRUD cycle.
Usage
Create Airtable base
Get Airtable base ID and API key
Install Airtable.EFCore
package.
//Register airtable as EF provider
services.AddDbContext<TestDbContext>(o => o.UseAirtable(config.GetValue<string>("BaseId"), config.GetValue<string>("ApiKey")));
Example model:
Create your model. Example uses Inventory Tracking template.
public class TestDbContext : DbContext
{
public TestDbContext(DbContextOptions options) : base(options)
{
}
public DbSet<DbProductInventory> ProductInventory { get; set; }
public DbSet<DbManufacturer> Manufacturers { get; set; }
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
modelBuilder.Entity<DbProductInventory>().ToTable("Product Inventory");
base.OnModelCreating(modelBuilder);
}
}
public class DbManufacturer
{
public string Id { get; set; }
public string Name { get; set; }
[Column("Contact Name")]
public string ContactName { get; set; }
public AirtableAttachment Image { get; set; }
}
public class DbProductInventory
{
public string Id { get; set; }
[Column("Units Ordered")]
public int Ordered { get; set; }
[Column("Product Name")]
public string ProductName { get; set; }
}
And you can work with it as with regular EF model!
Translated features
Airtable Views
FromView
extension limit querying to specific view.
await db.Manufacturers.FromView("San").FirstOrDefaultAsync(i=>i.Name == "Something");
Airtable formulas translated
C# | Airtable | Comment |
---|---|---|
= |
= |
Simple equality operator |
Regex.IsMatch |
REGEX_MATCH() |
No options additional supported by airtable |
String.Equals |
Equality operator = |
Case insensitivity achieved via UPPER function |
String.Contains |
FIND() |
Case insensitivity achieved via UPPER function |
&& |
AND |
|
\|\| |
OR |
|
DateTimeOffset comparison operators |
Combination of NOT and IS_AFTER and IS_BEFORE |
|
Entity property reference | Record property reference encoded in {} |
|
Entity primary key reference | RECORD_ID() |
With special optimization for query by primary key only |
Attachment support
Use property of type AirtableAttachment
or ICollection<AirtableAttachment>
to work with attachments.
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 was computed. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 was computed. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. |
-
net6.0
- Airtable (>= 1.2.0)
- Microsoft.EntityFrameworkCore (>= 6.0.9)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.