public SpeciesListViewModel(IDatabaseHost iDatabaseHost) { IDatabaseHost = iDatabaseHost; SpeciesCollection = new System.Collections.ObjectModel.ObservableCollection <DBObject.Species>(); Load(); }
public static void OpenDatabase(IDatabaseHost databaseHost, string host, int port, bool useWindowsAuthentication, string userName, string password, string dbName) { string connectionString = MakeConnectionString(host, port, useWindowsAuthentication, userName, password, dbName); databaseHost.Database = new PetaPoco.Database(connectionString, "MySql"); databaseHost.Database.OpenSharedConnection(); }
public static void CreateDatabase(IDatabaseHost databaseHost, string folder, string dbName) { string path = System.IO.Path.Combine(folder, dbName + ".sqlite"); databaseHost.Database = new PetaPoco.Database("Data Source=" + path + ";Version=3;", "System.Data.SQLite"); databaseHost.Database.OpenSharedConnection(); }
public static void CreateDatabase(IDatabaseHost databaseHost, string host, int port, bool useWindowsAuthentication, string userName, string password, string dbName) { // Connect to the master DB to create the requested database OpenDatabase(databaseHost, host, port, useWindowsAuthentication, userName, password, "MySql"); databaseHost.Database.Execute(@"CREATE DATABASE " + dbName); databaseHost.Database.CloseSharedConnection(); // Connect to the new database OpenDatabase(databaseHost, host, port, useWindowsAuthentication, userName, password, dbName); }
public static void CreateDatabase(IDatabaseHost databaseHost, string host, int port, bool useWindowsAuthentication, string userName, string password, string dbName) { // Connect to the master DB to create the requested database OpenDatabase(databaseHost, host, port, useWindowsAuthentication, userName, password, "postgres"); databaseHost.Database.Execute(@"CREATE DATABASE " + dbName + @" WITH OWNER = postgres ENCODING = 'UTF8' CONNECTION LIMIT = -1;"); databaseHost.Database.CloseSharedConnection(); // Connect to the new database OpenDatabase(databaseHost, host, port, useWindowsAuthentication, userName, password, dbName); }
public static void CreateDatabase(IDatabaseHost databaseHost, string dataSource, bool useWindowsAuthentication, string userName, string password, string folder, string dbName) { // Connect to the master DB to create the requested database OpenDatabase(databaseHost, true, dataSource, null, -1, useWindowsAuthentication, userName, password, "master"); string filename = System.IO.Path.Combine(folder, dbName); databaseHost.Database.Execute("CREATE DATABASE " + dbName + " ON PRIMARY (Name=" + dbName + ", filename = \"" + filename + ".mdf\") LOG ON (name=" + dbName + "_log, filename=\"" + filename + ".ldf\")"); databaseHost.Database.CloseSharedConnection(); // Connect to the new database OpenDatabase(databaseHost, true, dataSource, null, -1, useWindowsAuthentication, userName, password, dbName); }
public static string GenerateRandomPassword(this IDatabaseHost _) { const string chars = "ABCDEFGHIJKLMNOPQRSTUVWXYZ" + "abcdefghijklmnopqrstuvwxyz" + "0123456789"; var rnd = new Random(DateTime.Now.Millisecond); var stringBuilder = new StringBuilder(); for (var x = 0; x < 16; x++) { var index = rnd.Next(0, chars.Length - 1); stringBuilder.Append(chars[index]); } return(stringBuilder.ToString()); }
public RepositoryBase(IDatabaseHost host) { _host = host; }
public PaymentRepository(IDatabaseHost host) : base(host) { }
public static void OpenDatabase(IDatabaseHost databaseHost, string filepath) { databaseHost.Database = new PetaPoco.Database("Data Source=" + filepath + ";Version=3;", "System.Data.SQLite"); databaseHost.Database.OpenSharedConnection(); }
public UserRepository(IDatabaseHost host) : base(host) { }