A
A
Andrey Plax2014-11-05 17:34:08
SQL
Andrey Plax, 2014-11-05 17:34:08

Best practice to pass parameters to C# method to write to SQL table?

I load records into the SQL table line by line, constantly. That is, each time there is a group of DIFFERENT parameters (so far only 10), forming a row in the database table.

public void InsertIntoDb (  x x x x x ) 
{ ... }

Where to read how it is more correct to pass parameters to the method:
- Array ? (only, you have to parse dates and numeric types before writing)
- Dictionary ?
- params[] ... ?
- somehow else?
What are the best practices on this matter?
...
Thanks in advance.

Answer the question

In order to leave comments, you need to log in

1 answer(s)
A
aush, 2014-11-05
@Hereigo

Create a type that combines this set of options and pass it in.
This is the classic Parameter Object pattern .

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question