alternative for hasura\firebase but for .net c# stack

Viewed 548

I am looking for ORM solution with automatic change propagation from server to clients as in Hasura\Firabase but specifically for C#.NET stack and (probably) .NET on client like in Blazor case. All that i fund is low level SignalR or Firebase unfinished bindings. Is There a better way for .NET ?

1 Answers

You should be able to use Hasura and it's subscriptions in C# .NET with Blazor on the client via GraphQL Dotnet Client:

https://github.com/graphql-dotnet/graphql-client/blob/master/SubscriptionIntegrationTest.ConsoleClient/Program.cs

I believe you would just need to emit the subscription events to Blazor client-side in the subscription handlers.

Outside of that, you could build your own, either using a library like this:

https://github.com/NickStrupat/EntityFramework.Triggers

public class MyContext : DbContextWithTriggers {
    public DbSet<Person> People { get; set; }
}
var mycontext  = new MyContext() { TriggersEnabled = true };
Triggers<Person>.Inserting += entry =>
{
    Console.WriteLine($"Person: {entry.Entity}");
};

Or by rolling a custom implementation using the ObservableCollection class:

https://docs.microsoft.com/en-us/dotnet/api/system.collections.objectmodel.observablecollection-1

Related