Page 1 of 1

How to read/write blobs using ORM classes

Posted: Tue 22 Sep 2015 15:39
by alegzis
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();
}
}
}

Re: How to read/write blobs using ORM classes

Posted: Wed 23 Sep 2015 11:32
by MariiaI
I am curious as to why the auto-generated code sets "IsDbGenerated" to true.
Please refer to:
http://www.postgresql.org/docs/8.1/stat ... e-oid.html
https://www.devart.com/linqconnect/docs ... pping.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/stat ... inary.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.