How to read/write blobs using ORM classes

How to read/write blobs using ORM classes

Postby alegzis » Tue 22 Sep 2015 15:39

I would like an example of how to get/set blob data using the ORM classes that are auto-generated by the Devart LinqConnectModel in C#. This is for a Postgres database. Given that I have a table called MyTable and a blob called "myblob" (defined as OID), the auto-generated code for this field is pasted below. My blob data is a byte buffer. Could you provide me with an example of getting/setting "myblob"? Btw, I am curious as to why the auto-generated code sets "IsDbGenerated" to true.

/// <summary>
/// There are no comments for myblob in the schema.
/// </summary>
[Column(Storage = "_myblob", AutoSync = AutoSync.Always, DbType = "OID", IsDbGenerated = true, IsVersion = true, UpdateCheck = UpdateCheck.Never)]
public System.Nullable<int> myblob
{
get
{
return this._myblob;
}
set
{
if (this._myblob != value)
{
this.OnmyblobChanging(value);
this.SendPropertyChanging();
this._myblob = value;
this.SendPropertyChanged("myblob");
this.OnmyblobChanged();
}
}
}
alegzis
 
Posts: 1
Joined: Tue 22 Sep 2015 15:04

Re: How to read/write blobs using ORM classes

Postby MariiaI » Wed 23 Sep 2015 11:32

I am curious as to why the auto-generated code sets "IsDbGenerated" to true.

Please refer to:
http://www.postgresql.org/docs/8.1/static/datatype-oid.html
https://www.devart.com/linqconnect/docs/postgresql_datatypemapping.html

a blob called "myblob" (defined as OID)

Generally, for blob columns in PostgreSQL the bytea data type is used:
http://www.postgresql.org/docs/9.1/static/datatype-binary.html
http://forums.devart.com/viewtopic.php?t=28414

We have sent you a small test project to the e-mail address you have provided in your forum profile. Please check that the letter is not blocked by your mail filter.

Please tell us if this helps.
MariiaI
Devart Team
 
Posts: 1472
Joined: Mon 13 Feb 2012 08:17


Return to dotConnect for PostgreSQL