S
someone
Hi,
I have two C# beginer questions.
What's the best way to store an object (as an example, person) in the
database?
Option 1 - Having in the data layer an object "person" with a method
save(), and an object "person" in the business layer, so what I have to
do is to call the person.save() method in the business layer and this
method call the person.save() method in the data layer.
Or...
Option 2 - Having a DAL class with generics methods for all objects.
Those methods could be generateCommand() and executeCommand() and the
object "person" in the business layer has a save() method, when you call
person.save() in the business layer, it call to the methods
generateCommand() (to create the SQL sentence) and executeCommand() (to
execute the SQL sentence) and these methods saves the object "person" in
the database.
I saw it in both ways so I don't know what's best.
Another question:
If I have in the data layer two objects: Header and Detail (part of
invoice), and I have to load and invoice by invoice number: Who is in
charge for loading these two objects? or where do I have to do the load?
data layer? how?
In advance thanks a lot for any help.
Regards,
Marcelo.
I have two C# beginer questions.
What's the best way to store an object (as an example, person) in the
database?
Option 1 - Having in the data layer an object "person" with a method
save(), and an object "person" in the business layer, so what I have to
do is to call the person.save() method in the business layer and this
method call the person.save() method in the data layer.
Or...
Option 2 - Having a DAL class with generics methods for all objects.
Those methods could be generateCommand() and executeCommand() and the
object "person" in the business layer has a save() method, when you call
person.save() in the business layer, it call to the methods
generateCommand() (to create the SQL sentence) and executeCommand() (to
execute the SQL sentence) and these methods saves the object "person" in
the database.
I saw it in both ways so I don't know what's best.
Another question:
If I have in the data layer two objects: Header and Detail (part of
invoice), and I have to load and invoice by invoice number: Who is in
charge for loading these two objects? or where do I have to do the load?
data layer? how?
In advance thanks a lot for any help.
Regards,
Marcelo.