views:

16

answers:

1

In theory I would like to produce 2 projects:

1) Asp.net (Sever A)

2) DAL running (Server B)

I would like to utilise command objects to comunicate with the DAL.

ASP.net instantiates a command class e.g. CmdGetAllUsers which impliments IMyCommand interface and sends it to the DAL (using ASMX or WCF).

My question is:

Would the class definition of CmdGetAllUsers need to exist on the DAL server? Or would having the interface definition be enough?

My goal is to reduce the need to redeploy the DAL code, and have it as a fairly simple pass-through layer.

Many thanks for your time.

A: 

To answer your question, no, the interface definition is not enough. It needs to have the concrete implementation because that's where the code to implement the methods lives. No code for the implementation, no execution.

On a larger note, why not just implement the methods in the service layer directly? Instead of passing a command back to your data layer to execute, have the service layer implement the method as a "command". Your DAL will be more conventional, but that's a good thing I think. Instead of scattering your DB code throughout all of the various Command class implementations, you'll have it localized in the DAL. You'll also have a central location (the service) to do any business-related rule-enforcement.

tvanfosson
@tvanfosson - The DAL is autogenerated and not used to perform any such rules. Personally I wish to remove the need for it to reside on a seperate machine however if I'm forced to keep it, I would like to if possible, have it act merely as a pass-through layer to reduce development/deployment cost. Thank you for your input.
Jonno