Northwind n-tier architecture.

Posts   
 
    
netLearner
User
Posts: 150
Joined: 18-Oct-2003
# Posted on: 26-May-2004 06:06:14   

Hi

Here is how i would implement Northwind n-tier. Please share your thoughts, it is nothing new from what Frans explains in his help manual, but just wanted to verify i am getting it right:

DataLayerClasses: (Generated by Llblgen Pro)

CustomerCollection OrderCollection DetailsCollection CustomerEntity OrderEntity DetailsEntity

BusinessLayer classes:

CustomersBusinessCollection : CustomerCollection (CustomersBusinessCollection inherits CustomerCollection)
OrdersBusinessCollection : OrdersCollection
DetailsBusinessCollection : DetailsCollection

CustomerBusiness: CustomerEntity
OrderBusiness: OrderEntity
DetailsBusiness: DetailsEntity

In CustomerBusiness add OrdersBusinessCollection which will hold a collection of OrderBusiness objects:

CustomerBusiness | --OrdersBusinessCollection (Collection of OrderBusiness)

OrdersBusiness | --DetailsBusinessCollection (Collection of DetailsBusiness)

If I want to add any Business logic i would add it to the Business classes and instantiate Business objects to implement it. Please let me know if you see anything wrong.

Thanks.

Posts: 497
Joined: 08-Apr-2004
# Posted on: 26-May-2004 10:51:04   

Self-servicing right?

Assuming it is, then I see a simple, reasonable, workable architecture. I'd be interested to see what other people think...

wayne avatar
wayne
User
Posts: 611
Joined: 07-Apr-2004
# Posted on: 26-May-2004 11:15:03   

Assuming it is, then I see a simple, reasonable, workable architecture.

hmmm maybe - except If you want CustomersBusinessCollection to contain m:CustomerBusiness entities.

I would like to know how you are going to acheive this?confused

CustomerCollection already contains m:CustomerEntity.

By deriving from CustomerCollection and creating CustomersBusinessCollection you will be inheriting the ancestors properties that already contains m:CustomerEntity.

So when working with the CustomersBusinessCollection's entities you will be bypassing your BL CustomerBusiness entities and working directly with the DL's CustomerEntity.

Example:

DL
CustomerCollection : EntityCollectionBase
 | - <  CustomerEntity

BL
CustomersBusinessCollection : CustomerCollection 
 | - <  Inherited CustomerEntity (Should these not be BL CustomerBusiness entities?) - This is working directly with DL?

I guess that you want to acheive this...

BL
CustomersBusinessCollection : CustomerCollection 
 | - <  CustomerBusiness 

The examples would be the same for entities linking to collections.

DL
CustomerEntity: CustomerEntityBase
 | -  OrdersCollection

BL
CustomerBusiness : CustomerEntity
 | - Inherited OrdersCollection(Should this not be a BL OrdersBusinessCollection?) - This is working directly with DL?

I guess that you want to acheive this...

BL
CustomerBusiness : CustomerEntity
 | -  OrdersBusinessCollection

I am not sure how you would acheive this. confused I might be missing something... confused

it is nothing new from what Frans explains in his help manual

Where in the manual?

As far as i know you can polymorph upwards to common ancestors not downwards to derived children.

Meaning that you can cast CustomerBusinessEntity as CustomerEntity but you can't cast CustomerEntity as CustomerBusinessEntity.

Please see 1st reply to MattWoberts http://www.llblgen.com/tinyforum/Messages.aspx?ThreadID=802&StartAtMessage=0

wayne avatar
wayne
User
Posts: 611
Joined: 07-Apr-2004
# Posted on: 26-May-2004 13:04:38   

OK i found in the manual - Extending the framework through inheritance (Adapter).

Please note this is an Adapter example - i don't think the example shown by netlearner is possible in self SelfServicing. disappointed

Posts: 497
Joined: 08-Apr-2004
# Posted on: 26-May-2004 14:06:04   

The code shown by netLearner is not possible in Adaptor model - because LLBL does not create these collections. You simply have an "EntityCollection", not a CustomerCollection etc etc etc...

The example in the help manual is a way to extend the entitties to add properties. I think that the recent beta's might remove the need to do this with the ability to define custom properties on entities, am I right? Still, it doesn't get away from the fact passing these LLBL entities to the PL is not always a good idea (as is discussed in other postings).

wayne avatar
wayne
User
Posts: 611
Joined: 07-Apr-2004
# Posted on: 26-May-2004 14:18:30   

The code shown by netLearner is not possible in Adaptor model

Thanks - my mistake.

I think that the recent beta's might remove the need to do this with the ability to define custom properties on entities, am I right?

Yes you are...wink this has actually always been possible - you just had to define your own templates.