44 lines
1.6 KiB
C#
44 lines
1.6 KiB
C#
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());
|
||
}
|
||
}
|
||
}
|
||
}
|