ac3f34e4f3
Added .gitignore, solution, and project files for .NET 10. Introduced AGENTS.md and PLAN.md for guidelines and planning. Implemented appsettings.json, launchSettings.json, and MySQL config. Created AppDBContext and all domain models with composite keys. Added IUnitOfWork and EFUnitOfWork. Structured feature folders for Region, Route, Vehicle, Store, Warehouse, and Order with DTOs, repositories, services, and controllers. Added initial EF Core migrations and sample HTTP request. Registered dependencies and enabled OpenAPI in development.
25 lines
872 B
C#
25 lines
872 B
C#
using Distribution.Models;
|
|
using Microsoft.EntityFrameworkCore;
|
|
|
|
namespace Distribution.Data;
|
|
|
|
public class AppDBContext(DbContextOptions<AppDBContext> options) : DbContext(options)
|
|
{
|
|
public DbSet<Region> Regions { get; set; }
|
|
public DbSet<Models.Route> Routes { get; set; }
|
|
public DbSet<Vehicle> Vehicles { get; set; }
|
|
public DbSet<Store> Stores { get; set; }
|
|
public DbSet<Warehouse> Warehouses { get; set; }
|
|
public DbSet<SaleRoute> SaleRoutes { get; set; }
|
|
public DbSet<Order> Orders { get; set; }
|
|
public DbSet<OrderItem> OrderItems { get; set; }
|
|
public DbSet<DeliveryRun> DeliveryRuns { get; set; }
|
|
public DbSet<Item> Items { get; set; }
|
|
|
|
protected override void OnModelCreating(ModelBuilder modelBuilder)
|
|
{
|
|
modelBuilder.Entity<OrderItem>()
|
|
.HasKey(oi => new { oi.FK_OrderId, oi.FK_ItemId });
|
|
}
|
|
}
|