1234567891011121314151617181920212223242526272829 |
- using Microsoft.EntityFrameworkCore;
- using System;
- using System.Net;
- using System.Windows;
- using WpfAppUI.Model;
- namespace WpfAppUI.Data
- {
- public class ApplicationContextUI : DbContext
- {
- public DbSet<Emploee> Emploees { get; set; }
- public DbSet<Post> Posts { get; set; }
- public ApplicationContextUI()
- {
- Database.EnsureCreated();
- }
- protected override void OnConfiguring(DbContextOptionsBuilder optionsBuilder)
- {
- string userName = Dns.GetHostName();
- IPAddress address = Dns.GetHostAddresses(userName)[0];
- if (address.ToString() == "fe80::f2c7:74a:aead:a3d4%22")
- optionsBuilder.UseLazyLoadingProxies().UseSqlServer("Data Source=vpmt.ru\\is3;Initial Catalog=Lavanda;Persist Security Info=True;User ID=user23;Password=user23;Trust Server Certificate=True;");
- else
- optionsBuilder.UseLazyLoadingProxies().UseSqlServer("Data Source=srv-wsr\\is3;Initial Catalog=Lavanda;Persist Security Info=True;User ID=user23;Password=user23;Trust Server Certificate=True;");
- }
- }
- }
|