Ejemplo n.º 1
0
        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);
        }
Ejemplo n.º 2
0
        protected BaseTable(ConnectionString connection)
        {
            if (String.IsNullOrWhiteSpace(connection.TableName))
            {
                throw new ArgumentException(nameof(connection.TableName));
            }

            _connectionString = ConnectionString.Build(connection);
        }
Ejemplo n.º 3
0
        public static Schema GetSchema(string schemaname = null)
        {
            var conbuilder = ConnectionString.Build()
                             .WithCredential("postgres", "postgres")
                             .WithDatabase("Tests")
                             .WithSchema(schemaname);

            return(new Schema(conbuilder).CreateIfNotExists());
        }
Ejemplo n.º 4
0
        private Schema GetSchema()
        {
            var conbuilder = ConnectionString.Build()
                             .WithCredential("postgres", "postgres")
                             .WithDatabase("Tests")
                             .WithSchema("LTreeTests");


            return(new Schema(conbuilder).CreateIfNotExists());
        }
Ejemplo n.º 5
0
 protected BaseTable(string connectionstring) : this(ConnectionString.Build(connectionstring))
 {
 }
Ejemplo n.º 6
0
 protected BaseTable() : this(ConnectionString.Build())
 {
 }
Ejemplo n.º 7
0
        private ObjectTable GetTable(string tableName)
        {
            var connstr = ConnectionString.Build(_connectionBuilder).WithTable(tableName);

            return(new ObjectTable(connstr).NotTyped());
        }
Ejemplo n.º 8
0
 public HistoryTable(ITable parentTable) : base(ConnectionString.Build(parentTable.GetConnectionString()).WithSchema($"{parentTable.GetConnectionString().SchemaName}#history"))
 {
     _parentTable = parentTable;
 }
Ejemplo n.º 9
0
 protected BaseListener(ConnectionStringBuilder connectionBuilder)
 {
     this._connectionBuilder = ConnectionString.Build(connectionBuilder);
 }