Skip to content

Instantly share code, notes, and snippets.

@Guifgr
Created October 31, 2021 20:57
Show Gist options
  • Save Guifgr/3a3addad290322b98d21c4d183832929 to your computer and use it in GitHub Desktop.
Save Guifgr/3a3addad290322b98d21c4d183832929 to your computer and use it in GitHub Desktop.
sqlite entity
using ChatMessageServer.Model;
using Microsoft.EntityFrameworkCore;
namespace ChatMessageServer.Database
{
public class Context : DbContext
{
public Context()
{
Database.EnsureCreated();
}
public DbSet<ChatMessage> ChatMessages { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder options)
{
options.UseSqlite("Data Source=Messages.db");
}
}
}
await using var context = new Context();
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment