linqpad-postgresql-driver icon indicating copy to clipboard operation
linqpad-postgresql-driver copied to clipboard

uuid is not support

Open haue opened this issue 6 years ago • 3 comments

unsupported uuid

haue avatar Jun 30 '18 02:06 haue

I just hit this problem. Is there any workarounds?

Nippius avatar Nov 24 '18 16:11 Nippius

The easiest way to replicate this is to create a new dotnet core console application and follow the guide from postgresql:

http://www.npgsql.org/efcore/

In the models provided for Blog and Post replace the following:

public int BlogId { get; set; } => public Guid BlogId { get; set; }

After this, create a migration (dotnet ef migrations add Initial) and create the database (dotnet ef database update).

Lastly, use Linqpad with this driver and try and add a new Blog:

Blog blog = new Blog();
blog.Name = "MyBlog";
blog.Url = "example.com";
var blogId = this.InsertWithIdentity(blog);
Console.WriteLine("Added blog:"+blogId);

Nippius avatar Nov 24 '18 17:11 Nippius

Ok the workaround I found was to enable the "Use experimental data types" in the driver connection dialog:

image

However, the drawback is that we can't use InsertWithIdentity() anymore. Instead, do it the old fashion way:

Blog blog = new Blog();
blog.Name = "MyBlog";
blog.Url = "example.com";
blog.BlogId = Guid.NewGuid(); // Generate the Guid here
this.Insert(blog); // Do a normal insert

This will work as expected but I didn't make extensive testing to see if something else breaks.

Nippius avatar Nov 24 '18 19:11 Nippius