common business layer?

  • Thread starter Thread starter Mani
  • Start date Start date
M

Mani

I am designing ASP.net application and a Pocket PC application with the same
functionality.
does anyone have experience in creating a common data framework which
disects the request and forwards to the respective data layer?
has anyone created a business layer that has been reused in the PPC project
..

Can you guys also share how many tiers do you guys use in your applications?

Thanks
Mani
 
Thanks Ginny,
I have been to the MS architecture center. .. and have not been able to
find anything helpful pertaining to my needs. its good for the enterprise,
where you have a large base.

need to build a common datalayer for the ASP.net and PPC application.
like in
eg: in ASP.net , instantiate a "User" and do a user.retrieveAll()
then do the exact same for PPC.

what i am using is a customized variant of the DAAB(which is invoked by data
layer to call stored procedures)..it breaks there.
This is an extension in design, so i dont want to redo the whole thing...

Has anyone has done something similar (fucntionality for ASP.net and PPC) ,
how is your code base/design ?
Do you guys use dual code base (one for asp.net and one for PPC) to execute
the same functionality?
basically looking for some of your design ideas for helping me in my own
brainstorming....

forgive my ignorance,
Mani.
 
Mani,

I have desktop and device apps that share business logic, but the approach I
use is to use data-bindable business objects that have different Load and
Save methods depending on the platform. I haven't done any production
ASP.net apps, but I assume a similar approach would work.

There's a book published by Microsoft Press that attempts to cover
enterprise designs that include devices and might give you some ideas:
http://www.amazon.com/exec/obidos/t.../102-0721001-7120917?v=glance#product-details
 
Ginny,

so what you have is a 2 tier logic.
Though the book reviews are not so welcoming, I will get hold of a used
book.

Thanks
Mani
 
Ginny Caughey said:
Mani,

I have desktop and device apps that share business logic, but the approach I
use is to use data-bindable business objects that have different Load and
Save methods depending on the platform. I haven't done any production
ASP.net apps, but I assume a similar approach would work.

Curiosity... How do you address the typed dataset issue, i.e. do you use
some adapted form of code for typed datasets on CF?

I have high hopes that the next CF release will help me out in this regard.
:-)

Best Regards,

Andy
 
Andy,

The Compact Framework v2 will support typed datasets as I understand it, but
I'm actually not using datasets in my apps. Collections of my business
objects are derived from ArrayList, which makes them data bindable, but they
are more lightweight than datasets. I could have instead used business
objects that inherited from DataSet though as you suggest, and at one time I
experimented with the typed datasets you get from xsd.exe and just remove
everything the compiler didn't like on the device side (mainly the
serializable stuff).
 
Hi Mani,

I would consider creating multiple datalayers but keeping the business layer
consistent across applications. It would be nearly impossible or at least
very sloppy to keep a single datalayer for the different application
platforms (i.e. Web, Pocket PC). For the web you will most likely be
hitting a large database where on the Pocket PC you may only have a subset
of that database or another type of datastore like xml, or flat files. The
goal then is to architect your business objects to be usable in all
environments so you will only need to rewrite your DataLayer which for the
most part is just CRUD functionality which you could probably generate.

Take care,

Tom

--
Tom Krueger
Microsoft Corporation
Program Manager
http://weblogs.asp.net/tom_krueger

This posting is provided "AS IS" with no warranties, and confers no rights.
Use of included script samples are subject to the terms specified at
http://www.microsoft.com/info/cpyright.htm
 
Thank you Tom,

My Idea is the same of having a common business logic. I am actually
thinking of an inspector sublayer between the businesslayer and datalayer,
which inspects the request and forwards to respective data layer.

anyone with different ideas?

forgive my ignorance,
Mani.
 
For the data portion you can use a factory class in the data tier to
create the specific type of data access object required by the
business tier. Such as:

interface ICustomer
{
SomeCollection FetchData(int Id);
}

class SqlCeCustomer : ICustomer
{
SomeCollection FetchData(int Id)
//CE specific code
}

class SqlCustomer : ICustomer
{
SomeCollection FetchData(int Id)
//Sql specific code
}

class CustomerFactory
{
ICustomer Create(SomeEnum type)
{
switch(type)
SomeEnum.SqlCe:
return new SqlCeCustomer();
SomeEnum.Sql:
return new SqlCustomer();
}
}

The Business tier could look up in a config file or be told by the UI
tier which type of data access object it will need to create.
 
Back
Top