How to read/write blobs using ORM classes
Posted: 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();
}
}
}
/// <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();
}
}
}