예제 #1
0
        private static AviaBuildDBEntities Connect(string userName, string password, out string connectionString)
        {
            AviaBuildDBEntities dbContext = null;

            connectionString = null;
            try
            {
                var entityString = new EntityConnectionStringBuilder()
                {
                    Provider = "System.Data.SqlClient",
                    Metadata = "res://*/AviaBuildDBModel.csdl|res://*/AviaBuildDBModel.ssdl|res://*/AviaBuildDBModel.msl",
                    ProviderConnectionString = @"data source=PC-KMS\SQLEXPRESS;initial catalog=AviaBuildDB;integrated security=False;MultipleActiveResultSets=True;App=EntityFramework"
                };
                entityString.ProviderConnectionString += ";user id=" + userName + ";Password=" + password;

                connectionString = entityString.ConnectionString;
                dbContext        = new AviaBuildDBEntities(connectionString);
                if (dbContext.Database.Exists())
                {
                    return(dbContext);
                }
            }
            catch (Exception ex)
            {
                Console.WriteLine(ex);
            }

            dbContext?.Dispose();
            return(null);
        }
예제 #2
0
 public WindowProcedures(AviaBuildDBEntities context)
 {
     InitializeComponent();
     Instance     = this;
     this.context = context;
 }
예제 #3
0
 public MainWindow(AviaBuildDBEntities context)
 {
     this.context = context;
     InitializeComponent();
 }
예제 #4
0
 private void RefreshAll()
 {
     context.Dispose();
     context = new AviaBuildDBEntities(DataHandler.Instance.CurrConnectionString);
 }