This commit is contained in:
2025-08-08 12:31:51 +03:00
parent 3301e17f22
commit 4796beac49
29 changed files with 2369 additions and 77 deletions

View File

@@ -0,0 +1,43 @@
using Microsoft.EntityFrameworkCore;
using Microsoft.EntityFrameworkCore.Metadata;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
namespace DugunSalonu.Models
{
internal class dugunsalonuContext:DbContext
{
public DbSet<Kullanici> kullanici { get; set; }
public DbSet<Salon> salon { get; set; }
public DbSet<Il> il { get; set; }
protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
{
optionsBuilder.UseNpgsql("Server=edoysoft.com;Database=DugunSalonu;User Id=postgres;Password=MgC1453MgC;", b => b.EnableRetryOnFailure());
base.OnConfiguring(optionsBuilder);
}
protected override void OnModelCreating(ModelBuilder modelBuilder)
{
base.OnModelCreating(modelBuilder);
foreach (var entityType in modelBuilder.Model.GetEntityTypes())
{
// Sütun isimlerini büyük harfe dönüştür
foreach (var property in entityType.GetProperties())
{
var columnName = property.GetColumnName(StoreObjectIdentifier.Table(entityType.GetTableName(), entityType.GetSchema()));
// property.SetColumnName(Encoding.ASCII.GetString(columnName.ToLower()));
}
// İsteğe bağlı: Tablo isimlerini de büyük harfe dönüştür (eğer istiyorsanız)
entityType.SetTableName(entityType.GetTableName().ToLower());
}
}
}
}