> The question is - how to pass the Order object to the DataLayer. Since
the
> DataLayer project is not referencing the ASP.NET project - it does not
> have
> any information about the public types exposed by ASP.NET project, so
I
> cannot create a method in DataLayer which accepts an Order class e.g.
> Public Function SaveOrderWithLineItems(ByVal thisOrder as Order) as
> Boolean. Does that mean I will have to create a dummy class in the
> DataLayer project called Order along with the OrderLineItems
collection?
> In
> that case I could serialize the ASPXProject.Order object and pass it
to
> the
> DataLayer and desterilize it into DataLayer.Order object. Will that
work?

The basic problem is that you can't compile a piece of code that works
with an Order object unless that piece of code knows what an Order
object looks like. Which makes sense.

It gets worse - if you try to make a dummy class, there are situations
where even though it looks to you like you have the same class in both
places, the runtime will consider them to be entirely different, and
will puke TypeMismatchExceptions all over you. Eww.

The usual way to deal with this is to break the common class out into a
separate assembly and reference it from both of the projects.

You can read messages from the Advanced DOTNET archive, unsubscribe from Advanced 
DOTNET, or
subscribe to other DevelopMentor lists at http://discuss.develop.com.

Reply via email to