mirror of
https://github.com/BarkProductions/barkman.git
synced 2026-06-13 06:11:55 +00:00
36 lines
1.0 KiB
C#
36 lines
1.0 KiB
C#
using Microsoft.EntityFrameworkCore;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
|
|
public class BarkContext : DbContext
|
|
{
|
|
public DbSet<InventoryItems> Inventory { get; set; }
|
|
|
|
public string DbPath { get; }
|
|
|
|
public BarkContext()
|
|
{
|
|
var folder = Environment.SpecialFolder.LocalApplicationData;
|
|
var path = Environment.GetFolderPath(folder);
|
|
DbPath = "./app.db";
|
|
}
|
|
|
|
// The following configures EF to create a Sqlite database file in the
|
|
// special "local" folder for your platform.
|
|
protected override void OnConfiguring(DbContextOptionsBuilder options)
|
|
=> options.UseSqlite($"Data Source={DbPath}");
|
|
}
|
|
|
|
public class InventoryItems
|
|
{
|
|
public int Id {get; set;}
|
|
public string Name { get; set; }
|
|
public string Brand { get; set; }
|
|
public string? SerialNumber { get; set; }
|
|
public string? Status { get; set; }
|
|
public float? RentalPrice { get; set; }
|
|
public float? ReplacementCost { get; set; }
|
|
public string? Notes { get; set; }
|
|
}
|
|
|