public static void RecreatePostgresDatabase(string section) { var connManagerMaster = new PostgresConnectionManager( Config.PostgresConnection.ConnectionString(section).CloneWithMasterDbName() ); var dbName = Config.PostgresConnection.ConnectionString(section).DbName; DropAndCreate(connManagerMaster, dbName); }
public void Prepare() { PostgresConnectionManager conMan = new PostgresConnectionManager(PostgresConnectionString); List <TableColumn> tc = new List <TableColumn>() { new TableColumn("Id", "INTEGER", allowNulls: false, isPrimaryKey: true, isIdentity: true), new TableColumn("FirstName", "VARCHAR(500)", allowNulls: true), new TableColumn("LastName", "VARCHAR(500)", allowNulls: true), }; CreateTableTask.Create(conMan, "NameTable", tc); }
public void Run() { PostgresConnectionManager conMan = new PostgresConnectionManager(PostgresConnectionString); //Import CSV CsvSource sourceCSV = new CsvSource("NameList.csv"); DbDestination importDest = new DbDestination(conMan, "NameTable"); sourceCSV.LinkTo(importDest); sourceCSV.Execute(); importDest.Wait(); //Export again DbSource <NameListElement> sourceTable = new DbSource <NameListElement>(conMan, "NameTable"); CsvDestination <NameListElement> destCSV = new CsvDestination <NameListElement>("Export.csv"); destCSV.Configuration.Delimiter = ";"; sourceTable.LinkTo(destCSV); sourceTable.Execute(); destCSV.Wait(); }
public void Run() { PostgresConnectionManager postgresConMan = new PostgresConnectionManager(PostgresConnectionString); SqlConnectionManager sqlConMan = new SqlConnectionManager(SqlServerConnectionString); //Transfer across databases DbSource <NameListElement> source = new DbSource <NameListElement>(postgresConMan, "NameTable"); RowTransformation <NameListElement> trans = new RowTransformation <NameListElement>( row => { row.FullName = row.LastName + "," + row.FirstName; return(row); }); DbDestination <NameListElement> dest = new DbDestination <NameListElement>(sqlConMan, "FullNameTable"); source.LinkTo(trans); trans.LinkTo(dest); source.Execute(); dest.Wait(); }
static void Main(string[] args) { string query = "SELECT id, name FROM public.employee;"; PostgresConnectionManager postgresConnection = new PostgresConnectionManager { //ConnStr = "Server=tek-mmmi-db0a.tek.c.sdu.dk;User Id=si3_2018_group_7; " + "Password=hens234:ISBN;Database=db_name;" ConnStr = "Server=127.0.0.1;User Id=ja;" + "Password=postgres;Database=public.employee;" }; postgresConnection.OpenConnection(); postgresConnection.QuerySetup(query); postgresConnection.ReadData(); postgresConnection.PrintData(); string query2 = "INSERT into employee values(9, NEWNAME);"; postgresConnection.QuerySetup(query2); postgresConnection.ReadData(); postgresConnection.PrintData(); postgresConnection.CloseConnection(); }
public TasksRepository(PostgresConnectionManager connectionManager, IMapper mapper) : base(connectionManager.GetConnection()) { _mapper = mapper; }
public ProjectsRepository(PostgresConnectionManager connectionManager) : base(connectionManager.GetConnection()) { }
public WorkingHoursRepository(PostgresConnectionManager connectionManager) : base(connectionManager.GetConnection()) { }
public NotificationsRepository(PostgresConnectionManager connectionManager) : base(connectionManager.GetConnection()) { }