How best to structure .Net Code

How best to structure .Net Code

am 06.01.2008 04:27:00 von Amelia

Hello,

Apologies for the easy coding questions but I have something I need to code
in .Net and am fairly new to coding and don't want to produce bad code so
after some advice from the experienced please:-

Problem to code:
--------------------
Pick up new records from SQL Server DB table.
Flag records as "being processed" with a status (this flagging as new ones
coming in all the time)
Loop through records - get more detail items (stored proc) and process
Update Status

My Idea how to Code:
--------------------------
In a transaction
Pick up records to process and put into a dataset.
Update the status of these records in DB table
Loop through records in Dataset. Use stored proc to retrieve all other
detail information required at once.
Update status

As I have to update the status of the records I am about to process, I can't
see a better way to process than to put records into a dataset first unless I
lock those records but this APP will be polling so less practical. For
everything else, I was just going to use the System.Data.SqlClient class and
SQL statement calls to get the records, and a Reader to loop through all my
detail data returned via a stored Proc.

Does this sound reasonable. Are there any better ways and should I be usinhg
Enterprise Library ? Thanks very much for the efforts and advice of any
replies! Most appreciated.

--
Kind Regards
Amelia

Re: How best to structure .Net Code

am 06.01.2008 23:16:13 von DFS

Seams ok to me, I think thats what I'd do. But im fairly noobish
myself....there may be a better way...

For mine, the quality of code snippits is of little concern as they can be
fixed easily. What is important is the whole architecture, you get that
wrong and its a nightmare for the next person...


"Amelia" wrote in message
news:10B5332A-A3E0-4D44-8D4C-B238FD9F854A@microsoft.com...
> Hello,
>
> Apologies for the easy coding questions but I have something I need to
> code
> in .Net and am fairly new to coding and don't want to produce bad code so
> after some advice from the experienced please:-
>
> Problem to code:
> --------------------
> Pick up new records from SQL Server DB table.
> Flag records as "being processed" with a status (this flagging as new ones
> coming in all the time)
> Loop through records - get more detail items (stored proc) and process
> Update Status
>
> My Idea how to Code:
> --------------------------
> In a transaction
> Pick up records to process and put into a dataset.
> Update the status of these records in DB table
> Loop through records in Dataset. Use stored proc to retrieve all other
> detail information required at once.
> Update status
>
> As I have to update the status of the records I am about to process, I
> can't
> see a better way to process than to put records into a dataset first
> unless I
> lock those records but this APP will be polling so less practical. For
> everything else, I was just going to use the System.Data.SqlClient class
> and
> SQL statement calls to get the records, and a Reader to loop through all
> my
> detail data returned via a stored Proc.
>
> Does this sound reasonable. Are there any better ways and should I be
> usinhg
> Enterprise Library ? Thanks very much for the efforts and advice of any
> replies! Most appreciated.
>
> --
> Kind Regards
> Amelia