コード例 #1
0
ファイル: PlayingTests.cs プロジェクト: dpen2000/Marten
        public void try_command_runner()
        {
            var builder = new SchemaBuilder();
            builder.CreateTable(typeof(SchemaBuilderTests.MySpecialDocument), typeof(Guid));
            builder.DefineUpsert(typeof (SchemaBuilderTests.MySpecialDocument), typeof(Guid));

            var id = Guid.NewGuid();

            using (var runner = new CommandRunner(ConnectionSource.ConnectionString))
            {
                runner.Execute(builder.ToSql());
                /*
                runner.Execute("mt_upsert_myspecialdocument", command =>
                {
                    command.Parameters.Add("docId", NpgsqlDbType.Uuid).Value = id;
                    command.Parameters.Add("doc", NpgsqlDbType.Json).Value = "{\"id\":\"1\"}";
                });

                runner.Execute("mt_upsert_myspecialdocument", command =>
                {
                    command.Parameters.Add("docId", NpgsqlDbType.Uuid).Value = id;
                    command.Parameters.Add("doc", NpgsqlDbType.Json).Value = "{\"id\":\"2\"}";
                });
                 * */
                //runner.DescribeSchema();
                runner.SchemaFunctionNames().Each(x => Debug.WriteLine(x));
            }
        }
コード例 #2
0
        public void write_document_table()
        {
            var builder = new SchemaBuilder();
            builder.CreateTable(typeof(MySpecialDocument));

            var sql = builder.ToSql();

            sql.ShouldContain("CREATE TABLE mt_doc_MySpecialDocument");
            sql.ShouldContain("jsonb NOT NULL");
        }