using System; using System.Diagnostics; using System.IO; using System.Collections.Generic; using System.ComponentModel.DataAnnotations; namespace Yavsc.Model.Admin { /// /// Data access. /// public class DataAccess { private string host = "localhost"; /// /// Gets or sets the host. /// /// The host. [StringLength(2056)] public string Host { get { return host; } set { host = value; } } private int port = 5432; /// /// Gets or sets the port. /// /// The port. public int Port { get { return port; } set { port = value; } } private string dbname = "yavsc"; /// /// Gets or sets the dbname. /// /// The dbname. public string Dbname { get { return dbname; } set { dbname = value; } } private string dbuser = "postgres"; /// /// Gets or sets the dbuser. /// /// The dbuser. public string Dbuser { get { return dbuser; } set { dbuser = value; } } private string dbpassword ; private string backupPrefix= "~/backup/global.backup"; /// /// Gets or sets the backup prefix. /// /// The backup prefix. public string BackupPrefix { get { return backupPrefix; } set { backupPrefix = value; } } /// /// Gets or sets the password. /// /// The password. [Required(ErrorMessage ="Please, specify a password")] public string Password { get { return dbpassword; } set { dbpassword = value; } } /// /// Connections the string. /// /// The string. public string ConnectionString() { return string.Format ("Server={0};Port={1};Database={2};User Id={3};Password={4};Encoding=Unicode;", Host,Port,Dbuser,Password); } } }