DAL or BOL? Can someone clarify?

Discussion in 'ASP .Net' started by Nemisis, Sep 20, 2006.

  1. Nemisis

    Nemisis Guest

    Hi all,

    I was wondering about where this code should go.

    Basically i have several tables in my database, when i add a row to a
    particular table, i will need to also add other entries in other
    tables.

    I would consider this to be code that should be in the BOL? Am i right
    in thinking that?

    The same if i was deleting records in the database, if a record is
    deleted from one table, i need to also delete other entries in other
    tables, BOL or DAL?

    My database is setup with relationships so SQL will report errors on
    foreign keys that cannot be deleted, so this is the one reason why i
    thought it may go in the DAL, but then again, it is a business rule,
    that if one row is deleted in one table, other row in other tables
    should be deleted.

    Can someone please let me know, or pass an article for me to read.

    Cheers
     
    Nemisis, Sep 20, 2006
    #1
    1. Advertising

  2. Nemisis

    Mark Rae Guest

    "Nemisis" <> wrote in message
    news:...

    > I was wondering about where this code should go.
    >
    > Basically i have several tables in my database, when i add a row to a
    > particular table, i will need to also add other entries in other
    > tables.
    >
    > I would consider this to be code that should be in the BOL? Am i right
    > in thinking that?
    >
    > The same if i was deleting records in the database, if a record is
    > deleted from one table, i need to also delete other entries in other
    > tables, BOL or DAL?
    >
    > My database is setup with relationships so SQL will report errors on
    > foreign keys that cannot be deleted, so this is the one reason why i
    > thought it may go in the DAL, but then again, it is a business rule,
    > that if one row is deleted in one table, other row in other tables
    > should be deleted.
    >
    > Can someone please let me know, or pass an article for me to read.


    I would say that in this case it's a combination of both BOL and DAL,
    depending on how your DAL is constructed.

    E.g. in my standard DAL I have an ExecuteInTransaction method which takes
    multiple database writes and executes them in an explicit transaction,
    returning a collection of the return values of each individual write plus an
    overall bool of whether the transaction was committed or rolled back.

    I would therefore construct a method or even an entire class in my BOL which
    would assemble the various SQL actions and then pass them to the
    ExecuteInTransaction method in my DAL.
     
    Mark Rae, Sep 20, 2006
    #2
    1. Advertising

  3. Nemisis

    Nemisis Guest

    Mark Rae wrote:
    > "Nemisis" <> wrote in message
    > news:...
    >
    > > I was wondering about where this code should go.
    > >
    > > Basically i have several tables in my database, when i add a row to a
    > > particular table, i will need to also add other entries in other
    > > tables.
    > >
    > > I would consider this to be code that should be in the BOL? Am i right
    > > in thinking that?
    > >
    > > The same if i was deleting records in the database, if a record is
    > > deleted from one table, i need to also delete other entries in other
    > > tables, BOL or DAL?
    > >
    > > My database is setup with relationships so SQL will report errors on
    > > foreign keys that cannot be deleted, so this is the one reason why i
    > > thought it may go in the DAL, but then again, it is a business rule,
    > > that if one row is deleted in one table, other row in other tables
    > > should be deleted.
    > >
    > > Can someone please let me know, or pass an article for me to read.

    >
    > I would say that in this case it's a combination of both BOL and DAL,
    > depending on how your DAL is constructed.
    >
    > E.g. in my standard DAL I have an ExecuteInTransaction method which takes
    > multiple database writes and executes them in an explicit transaction,
    > returning a collection of the return values of each individual write plus an
    > overall bool of whether the transaction was committed or rolled back.
    >
    > I would therefore construct a method or even an entire class in my BOL which
    > would assemble the various SQL actions and then pass them to the
    > ExecuteInTransaction method in my DAL.


    Mark,

    Thanks for this, i have got my DAL and BOL that both accept a
    IDBTransaction property, so i think i can handle it just as you said.

    Cheers
     
    Nemisis, Sep 20, 2006
    #3
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Kathy Burke
    Replies:
    5
    Views:
    383
    Kathy Burke
    Aug 26, 2003
  2. techmaccoy
    Replies:
    3
    Views:
    481
  3. dos-man 64
    Replies:
    27
    Views:
    801
    Arne Vajhøj
    May 17, 2009
  4. Joshua Beall
    Replies:
    10
    Views:
    344
    Andrew Stewart
    Jan 19, 2008
  5. Replies:
    0
    Views:
    592
Loading...

Share This Page