-
-
Notifications
You must be signed in to change notification settings - Fork 461
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add ReloadTypes function to document store advanced to reload npgsql …
…type cache - Add ReloadTypes function to document store advanced to reload npgsql type cache - Add unit test - Add docs fixes GH-2515
- Loading branch information
1 parent
f28f096
commit 75de9c8
Showing
6 changed files
with
82 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
34 changes: 34 additions & 0 deletions
34
src/DocumentDbTests/Configuration/ability_to_add_custom_pg_type_fetch_data.cs
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,34 @@ | ||
using System.Threading.Tasks; | ||
using Marten.Testing; | ||
using Marten.Testing.Harness; | ||
using Shouldly; | ||
using Weasel.Postgresql; | ||
using Xunit; | ||
|
||
namespace DocumentDbTests.Configuration; | ||
|
||
public class ability_to_add_custom_pg_type_fetch_data: OneOffConfigurationsContext | ||
{ | ||
[Fact] | ||
public async Task can_register_a_custom_feature_and_reload_types() | ||
{ | ||
await using (var conn = theStore.CreateConnection()) | ||
{ | ||
await conn.OpenAsync(); | ||
var cmd = conn.CreateCommand( | ||
$"DROP TYPE IF EXISTS {SchemaName}.mood;CREATE TYPE {SchemaName}.mood AS ENUM ('sad', 'ok', 'happy');"); | ||
await cmd.ExecuteNonQueryAsync(); | ||
} | ||
|
||
await theStore.Advanced.ReloadTypes(); | ||
|
||
await using (var conn = theStore.CreateConnection()) | ||
{ | ||
await conn.OpenAsync(); | ||
var cmd = conn.CreateCommand($"select 'happy'::{SchemaName}.mood"); | ||
await using var reader = await cmd.ExecuteReaderAsync(); | ||
reader.Read(); | ||
reader.GetValue(0).ShouldBe("happy"); | ||
} | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters