Skip to content
Advertisement

Can you somehow overload the query in a method?

So there’s a Customer and a Seller and they’re both User. The only difference between them is that seller has a NameOfBusiness and customer does not.

In the DAL I have this code:

Is there a way to overload the query OR change the query so that you can fill in a NULL for NameOfBusiness?

Advertisement

Answer

Option A Do almost nothing

Rename CreateSeller to Create and use it as it is. Name of business is likely empty for customers already.

Option B Do just a little bit

Create could take in a bool parameter and clear name of business.

Option C. Craft

Create could take in a bool parameter and modify the query and the Parameters accordingly. Something like the following.

User contributions licensed under: CC BY-SA
4 People found this is helpful
Advertisement