public static void CreateDatabase() { var tbd = new TableDefinition(); tbd.AddColumn("RequestId", "guid").AsPrimaryKey().DefaultValue(DefaultValues.Guid.New); tbd.AddColumn("Reference", "string").CanBeNull(); tbd.AddColumn("JobName", "string").CanNotBeNull(); tbd.AddColumn("Data", "object").CanBeNull(); tbd.AddColumn("Response", "object").CanBeNull(); tbd.AddColumn("Status", "string").CanNotBeNull(); tbd.AddColumn("CreatedAt", "datetime").CanNotBeNull(); tbd.AddColumn("UpdatedAt", "datetime").CanBeNull(); var conn = ConnectionString.Build() .WithCredential("postgres", "postgres") .WithDatabase("TestScripting") .WithSchema("Test"); var tbl = new Schema(conn).CreateIfNotExists().CreateTable("Table", tbd, false); var dict = new Dictionary <string, object>(); dict.Add("RequestId", null); dict.Add("Reference", null); dict.Add("JobName", "test"); dict.Add("Data", null); dict.Add("Response", null); dict.Add("Status", "New"); dict.Add("CreatedAt", DateTime.Now); dict.Add("UpdatedAt", null); var id = tbl.Insert(dict); }
protected BaseTable(ConnectionString connection) { if (String.IsNullOrWhiteSpace(connection.TableName)) { throw new ArgumentException(nameof(connection.TableName)); } _connectionString = ConnectionString.Build(connection); }
public static Schema GetSchema(string schemaname = null) { var conbuilder = ConnectionString.Build() .WithCredential("postgres", "postgres") .WithDatabase("Tests") .WithSchema(schemaname); return(new Schema(conbuilder).CreateIfNotExists()); }
private Schema GetSchema() { var conbuilder = ConnectionString.Build() .WithCredential("postgres", "postgres") .WithDatabase("Tests") .WithSchema("LTreeTests"); return(new Schema(conbuilder).CreateIfNotExists()); }
protected BaseTable(string connectionstring) : this(ConnectionString.Build(connectionstring)) { }
protected BaseTable() : this(ConnectionString.Build()) { }
private ObjectTable GetTable(string tableName) { var connstr = ConnectionString.Build(_connectionBuilder).WithTable(tableName); return(new ObjectTable(connstr).NotTyped()); }
public HistoryTable(ITable parentTable) : base(ConnectionString.Build(parentTable.GetConnectionString()).WithSchema($"{parentTable.GetConnectionString().SchemaName}#history")) { _parentTable = parentTable; }
protected BaseListener(ConnectionStringBuilder connectionBuilder) { this._connectionBuilder = ConnectionString.Build(connectionBuilder); }