Re: Referenceing Projects

Tech-Archive recommends: Repair Windows Errors & Optimize Windows Performance



Hi Bruce,

So in the third project (let's call it 'Third'), I have have an abstract
Vehicle class with no default implementations (let's assume that I don't need
them). Now, I create classes in each of the Business and Messaging projects
that inherit from the Vehicle abstract class in Third. Let's call these
BVehicle and MVehicle, respectively. Within each of these I implement
property and method calls. The calls in BVehicle will be different from the
calls in MVehicle (since each class retrieves different sets of data: i.e.
BVehicle calls the Database project's BVehicle class and receives VIN and
Make information becuase that's what's in the home-grown database; MVehicle
will retrieve Year and ValidateCoverages information because that's what's in
the third-party database.)

Now what? How does the UI project (i.e. my webform) use these? The idea
was to encapsulate all of the information in the Business project's Vehicle
class. Am I actually encapsulating it in the Third project's abstract
Vehicle class? I can't use the abstract class (because its abstract) so how
do I use these two classes to get the information that I want?

I want to be able to dim something as a vehicle and say:

Dim CarVIN as string = myCar.VIN '''''comes from home-grown database
Dim CarMake as string = myCar.Make '''''comes from third-party database

Thank you for your help,
--
Joe

VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation


"Bruce Barker" wrote:

> thats why you make a third project that's just the data defs. just create a
> new library project and add to the solution. move the data classes (such as
> vehicle to it). do not include any code that talks to data sources (or bi
> logic).
>
> now in the BI & Messaging classes create classes that inherit from the data
> class, and add their logical methods. if you need a common method define a
> default implementation in the data class and override in the others.
>
> this is a good case of defining interfaces but inheritance will work fine.
>
> -- bruce (sqlwork.com)
>
>
>
>
> "Joe" <joeherro@xxxxxxxxxxxxxxxxxxx> wrote in message
> news:D4403D30-E0A0-4293-ABEA-8F87662DD0C9@xxxxxxxxxxxxxxxx
> > Hi Kevin,
> >
> > Thank you so much for your reply. I can not break the reference to the
> > Business project that the Messaging project has. Please read on.
> >
> > This company has two data sources. The Messaging project contains classes
> > that retrieve data from the third-party system (via XML). The Database
> > project contains classes that retrieve data from the company's home-grown
> > databases. They both have the same purpose: to retrieve data, but they
> > retrieve data from different sources in different ways.
> >
> > The Messaging project references the Business project because its methods
> > use classes that are in the Business project (for eample, Vehicle,
> > CommercialUnit, Policy). The Business project classes have data retrieved
> > from the company's home-grown databases and now need to retrieve data from
> > the third-party databases. That's why the Business objects are passed to
> > the
> > Messaging classes; they contain information that the Messaging classes use
> > to
> > retrieve data.
> >
> > I agree with you: a Business class should provide business logic for a
> > certain set of data. I, however, have no control over the initial design
> > of
> > this solution. The developers who built this solution designed it this
> > way
> > because they wanted the Messaging classes to be able to receive a business
> > object (say a Vehicle object with info about a certain vehicle); the
> > reason
> > that they did this is because a Vehicle has a ton of information connected
> > with it and they didn't want to have to pass 40 parameters to a Messaging
> > method call when they can jsut pass one object.
> >
> > What I am trying to do is find a way to excapsulate data calls, so that
> > when
> > I ask for a piece of information regarding a Vehicle (for example), the
> > Business class will retrieve what I request from either the hown-grown
> > system
> > or the third-party system whichever is appropriate. The problem is that I
> > can not reference the Messaging project from the Business project because
> > that would create a circular reference.
> >
> > What do you think? Still the same idea? Another?
> > --
> > Joe
> >
> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> >
> >
> > "Kevin Spencer" wrote:
> >
> >> Hi Joe,
> >>
> >> It seems to me that your current model has a fatal flaw. You say that
> >> Messaging is similar to Database. By this, I believe you mean that it is
> >> a
> >> layer unto itself that provides Messaging capabilities and is therefore,
> >> like Database, re-usable. But it is dependent upon the Business class.
> >>
> >> A Business class should provide business logic for a specific set of
> >> data.No
> >> lower-tier objects should be dependent upon it.
> >>
> >> Now, the way we handle this sort of thing is to have an assembly that
> >> provides data and functionality that is globally available to any class
> >> in
> >> any assembly in any NameSpace. This assembly (and the NameSpaces in it)
> >> functions much like the mscorlib or System assembly in the CLR. It is
> >> composed of logging capabilities, utility functions, and a number of
> >> other
> >> globally-useful classes and members that can be used by any assembly. It
> >> has
> >> no external dependencies, other than the CLR.
> >>
> >> When we create a new project for a specific purpose, we design business
> >> classes that use the members of this assembly for this type of thing. And
> >> our Data classes also use this assembly. In your case, your Messaging
> >> classes could use a similar assembly. This way, the Business classes
> >> could
> >> be dependent upon the Messaging as well as the Data classes.
> >>
> >> --
> >> HTH,
> >>
> >> Kevin Spencer
> >> Microsoft MVP
> >> ..Net Developer
> >> Complex things are made up of
> >> Lots of simple things.
> >>
> >> "Joe" <joeherro@xxxxxxxxxxxxxxxxxxx> wrote in message
> >> news:5E7F3EAD-EFC1-4901-9D09-E4E7047637E8@xxxxxxxxxxxxxxxx
> >> > Hello All:
> >> >
> >> > I have a solution with four projects (UI, Business, Database and
> >> > Messaging).
> >> > UI has references to Business and Messaging; Business has a refernce to
> >> > Database; Messaging has a reference to Business. UI handles the
> >> > presentation; Business provides Presentation with an abstract layer
> >> > through
> >> > which to retrieve data; Database handles database calls. Messaging
> >> > handles
> >> > calls to a third-party system; it is similar to Database.
> >> >
> >> > I do not have the option of combining Databbase and Messaging; I need
> >> > to
> >> > retain this architecture (client requirement).
> >> >
> >> > What I want to do is provide a way for Business to call Messaging so
> >> > that
> >> > I
> >> > can continue to abstract how or where data comes from. (UI doesn't
> >> > need
> >> > to
> >> > know where information comes from.)
> >> >
> >> > It was suggested in a previous post that I create a third project
> >> > (ref'd
> >> > by
> >> > both Business and Messaging) that defines abstact classes and allow the
> >> > Business project to implement these.
> >> >
> >> > Does anyone know of an online example showing how to do this? Could
> >> > someone
> >> > provide a simple example of how this works or what it would look like?
> >> > I
> >> > don't have a lot of time (maybe a week) and have limited experience
> >> > implementing such solutions.
> >> >
> >> > TIA,
> >> > --
> >> > Joe
> >> >
> >> > VB.NET/C#/ASP.NET/ASP/VB/C++/Web and DB development/VBA Automation
> >>
> >>
> >>
>
>
>
.



Relevant Pages

  • Re: Referenceing Projects
    ... > Business project that the Messaging project has. ... > that retrieve data from the third-party system. ... >> Messaging is similar to Database. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Referenceing Projects
    ... Messaging is similar to Database. ... But it is dependent upon the Business class. ...
    (microsoft.public.dotnet.framework.aspnet)
  • Re: Visiting Florida
    ... > You claim to own a "stretch limo" but you don't know what one is? ... > well for what it's worth a "stretch" is a vehicle which has been ... I'm a farmer and a business consultant. ... Pat Gardiner ...
    (uk.business.agriculture)
  • Re: Single Person Sole Proprietorship Catch-22?
    ... being able to depreciate a dedicated business vehicle and business ... or equipment into service... ... suddenly implies that the vehicle and/or equipment was "converted from ... I certainly don't see it that way, and I've never heard of the IRS pressing ...
    (misc.taxes)
  • Re: NPPL in Scotland
    ... > vehicle has been, and if it doesn't know it can't tell anybody when ... > the power comes back up. ... Since when did governments collect tax by the most convenient method!, ... In electronics there is no OLD business... ...
    (uk.rec.aviation)