Click here to Skip to main content
15,883,819 members
Articles / Programming Languages / C#

Backup/Restore PostgreSQL databases

Rate me:
Please Sign up or sign in to vote.
4.50/5 (5 votes)
5 Mar 2013CPOL1 min read 33.2K   4.5K   10  
Allow your applications the ability to backup and restore your PostgreSQL databases.
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;

namespace pgstore
{
    public class Config
    {
        public Config()
        {
            Parametres = new StoreParameters();
            Port = 5432;
            ServerName = "localhost";
            UserName = "postgres";
            Password = "";
        }

        public string ServerName { get; set; }
        public string DataBase { get; set; }
        public string UserName { get; set; }
        public string Password { get; set; }
        public int Port { get; set; }

        public bool AllISOK(ref string message)
        {
            bool b = true;
            if (this.ServerName == "") { b = false; message = "missing server name"; }
            if (this.DataBase == "") { b = false; message = "Missing database"; }
            if (this.UserName == "") { b = false; message = "Missing username"; }
            return b;
        }
        public StoreParameters Parametres
        { get; set; }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior) B&B
Tunisia Tunisia
Microsoft DOTNET developer
VOIP Technologies
ERP Petales

http://www.declaration.tn/

Comments and Discussions