Skip to content

Work around binary writing support - #2445

Merged
roji merged 2 commits into
npgsql:devfrom
roji:WriteByteaFromMemory
May 3, 2019
Merged

roji merged 2 commits into
npgsql:devfrom
roji:WriteByteaFromMemory

Conversation

@roji

@roji roji commented Apr 18, 2019

Copy link
Copy Markdown
Member
  • Support writing bytea from ReadOnlyMemory and Memory
  • Support async I/O when making direct writes

Closes #2392, #2444

* Support writing bytea from ReadOnlyMemory<byte> and Memory<byte>
* Support async I/O when making direct writes

Closes npgsql#2392, npgsql#2444
Comment thread src/Npgsql/TypeHandlers/ByteaHandler.cs Outdated
"bytea",
NpgsqlDbType.Bytea,
DbType.Binary,
new[] { typeof(byte[]), typeof(ReadOnlyMemory<byte>), typeof(Memory<byte>), typeof(ArraySegment<byte>) })]

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should this be put into a conditional compilation block too? Or should conditions be completely removed?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there a reason for conditional compilation here? Memory and ROM are supported back on netstandard2.0 via the System.Memory nuget (even if they're less efficient).

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Just don't understand why do we need #if !NETSTANDARD2_0 && !NET461 block everywhere except this place?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

AFAIK all places where we have #if, it's because something isn't supported on netstandard2.0/net461 - this is simply not the case here, it's supported. Can you point to an #if which you don't understand?

Copy link
Copy Markdown
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sorry, my fault! I already forgot the context of this PR, you're right - we shouldn't register Memory on TFMs where it can't be written...!

@roji
roji merged commit 951dc83 into npgsql:dev May 3, 2019
@roji
roji deleted the WriteByteaFromMemory branch May 3, 2019 19:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Support writing binary data from ReadOnlyMemory<byte>

2 participants