Derived dblinq entity class without creating constructor

  • Thread starter Thread starter Andrus
  • Start date Start date
A

Andrus

I have dynamically generated (at runtime) entity class based on entity class
generated by pgsqlmetal:

public class Klient : EntityBase.xKlient {
public Klient() { }
}


xKlient is generated by sqlmetal at design time like:

public partial class xKlient : IModified {
protected bool _isModified_;
public bool IsModified {
get { return _isModified_; }
set { _isModified_ = value; }
}

protected string _p_kood;
....
public xKlient() {
}

public xKlient(string p_kood, string regnr, string vatpayno,
.... )
....


From my application I use

db = new mydb(connStr);
var q4 = from k in db.Klients select k;
return q4.ToList();

This causes error dblinq driver error

CompileColumnRow: need projData with ctor2

If I add public contructor containing all properties to Klient class all is
OK.

Building full parameter constuctor requires database structure querying or
getting properties from xKlient type using reflection.
This makes assembly generation complicated.

How to use Klient class without manually creating contructor containing
all properties ?

Andrus.
 
Andrus,

This is more an issue with C# than anything else. Constructors are not
inherited when you derive from a class in C#, so you have to create them
yourself if you are going to extend a class and want to offer the same
functionality.
 
Back
Top