I have a class constructor method that when called makes a query in another database class that returns me the same class as the constructor method ( only with assigned data ), eg
public Invoice(int id)
{
CallDB db = new CallDB();
Invoice invoice = db.ReturnInvoice(id);
this.Filial = invoice.Filial;
this.UserProfileModel = invoice.UserProfileModel;
this.DataEmissao = invoice.DataEmissao;
this.DataVencimento = invoice.DataVencimento;
this.ID = invoice.ID;
}
I would not like to be using this
"300 thousand" times, would it be possible to do something like this?
public Invoice(int id)
{
CallDB db = new CallDB();
Invoice invoice = db.ReturnInvoice(id);
this.Invoice = invoice ; //estou atribuindo a classe como um todo ao invés de cada atributo separadamente
}