Skip to content
  • Categories
  • Recent
  • Tags
  • Popular
  • World
  • Users
  • Groups
Skins
  • Light
  • Cerulean
  • Cosmo
  • Flatly
  • Journal
  • Litera
  • Lumen
  • Lux
  • Materia
  • Minty
  • Morph
  • Pulse
  • Sandstone
  • Simplex
  • Sketchy
  • Spacelab
  • United
  • Yeti
  • Zephyr
  • Dark
  • Cyborg
  • Darkly
  • Quartz
  • Slate
  • Solar
  • Superhero
  • Vapor

  • Default (No Skin)
  • No Skin
Collapse
Code Project
  1. Home
  2. General Programming
  3. C#
  4. UI, BLL and DAL

UI, BLL and DAL

Scheduled Pinned Locked Moved C#
databasedesignsql-serversysadminbusiness
6 Posts 4 Posters 0 Views 1 Watching
  • Oldest to Newest
  • Newest to Oldest
  • Most Votes
Reply
  • Reply as topic
Log in to reply
This topic has been deleted. Only users with topic management privileges can see it.
  • P Offline
    P Offline
    paper67
    wrote on last edited by
    #1

    Hi, I'm trying to come up with the architecture for my new project. It's a window form based application with a SQL Server backend. I would like to use a multi-tiered approach with the database, a data access layer, a business logic layer and a user interface layer. The structure of the solution is as follows - DAL (Class Library) - BLL (Class Library) - UI (Window form application) From what I understand, the UI should not have access to the DAL (except via the BLL), so there should be no reference to the DAL in the UI. Wright ? I use the "TableAdapter Configuration Wizard" to generate my DAL code, which sometimes returns typed datatables. The businesslogic layer returns those same typed datatables that were defined in the DAL. I'm setting the data source of a gridview to that typed datatable. This requires that the UI know something about the datatable defined in the DAL, so to make this work I have to place a reference to the DAL in my UI layer, which I supose is not good programming practise. How should this be done ??

    L P N 3 Replies Last reply
    0
    • P paper67

      Hi, I'm trying to come up with the architecture for my new project. It's a window form based application with a SQL Server backend. I would like to use a multi-tiered approach with the database, a data access layer, a business logic layer and a user interface layer. The structure of the solution is as follows - DAL (Class Library) - BLL (Class Library) - UI (Window form application) From what I understand, the UI should not have access to the DAL (except via the BLL), so there should be no reference to the DAL in the UI. Wright ? I use the "TableAdapter Configuration Wizard" to generate my DAL code, which sometimes returns typed datatables. The businesslogic layer returns those same typed datatables that were defined in the DAL. I'm setting the data source of a gridview to that typed datatable. This requires that the UI know something about the datatable defined in the DAL, so to make this work I have to place a reference to the DAL in my UI layer, which I supose is not good programming practise. How should this be done ??

      L Offline
      L Offline
      Lost User
      wrote on last edited by
      #2

      Move the datatables to a new Class Library project and add reference to this library from your DAL and UI projects.

      1 Reply Last reply
      0
      • P paper67

        Hi, I'm trying to come up with the architecture for my new project. It's a window form based application with a SQL Server backend. I would like to use a multi-tiered approach with the database, a data access layer, a business logic layer and a user interface layer. The structure of the solution is as follows - DAL (Class Library) - BLL (Class Library) - UI (Window form application) From what I understand, the UI should not have access to the DAL (except via the BLL), so there should be no reference to the DAL in the UI. Wright ? I use the "TableAdapter Configuration Wizard" to generate my DAL code, which sometimes returns typed datatables. The businesslogic layer returns those same typed datatables that were defined in the DAL. I'm setting the data source of a gridview to that typed datatable. This requires that the UI know something about the datatable defined in the DAL, so to make this work I have to place a reference to the DAL in my UI layer, which I supose is not good programming practise. How should this be done ??

        P Offline
        P Offline
        PIEBALDconsult
        wrote on last edited by
        #3

        Having data classes bubble up from the DAL shouldn't be a problem; but, as Shameel said, defining them in a separate place is even better.

        paper67 wrote:

        I use the "TableAdapter Configuration Wizard" to generate my DAL code

        I prefer to roll my own and maintain control.

        P 1 Reply Last reply
        0
        • P paper67

          Hi, I'm trying to come up with the architecture for my new project. It's a window form based application with a SQL Server backend. I would like to use a multi-tiered approach with the database, a data access layer, a business logic layer and a user interface layer. The structure of the solution is as follows - DAL (Class Library) - BLL (Class Library) - UI (Window form application) From what I understand, the UI should not have access to the DAL (except via the BLL), so there should be no reference to the DAL in the UI. Wright ? I use the "TableAdapter Configuration Wizard" to generate my DAL code, which sometimes returns typed datatables. The businesslogic layer returns those same typed datatables that were defined in the DAL. I'm setting the data source of a gridview to that typed datatable. This requires that the UI know something about the datatable defined in the DAL, so to make this work I have to place a reference to the DAL in my UI layer, which I supose is not good programming practise. How should this be done ??

          N Offline
          N Offline
          Not Active
          wrote on last edited by
          #4

          In addition to the other comments I would consider Enity Framework for the entities and DAL. Place the former in a seperate assembly to be references in the other layers.


          I know the language. I've read a book. - _Madmatt

          1 Reply Last reply
          0
          • P PIEBALDconsult

            Having data classes bubble up from the DAL shouldn't be a problem; but, as Shameel said, defining them in a separate place is even better.

            paper67 wrote:

            I use the "TableAdapter Configuration Wizard" to generate my DAL code

            I prefer to roll my own and maintain control.

            P Offline
            P Offline
            paper67
            wrote on last edited by
            #5

            So when I intend to keep the wizards autogenerated code, referencing the DAL in the UI layer to access the typed dataset, datatable and datarow types returned from the BLL is not so bad ??

            P 1 Reply Last reply
            0
            • P paper67

              So when I intend to keep the wizards autogenerated code, referencing the DAL in the UI layer to access the typed dataset, datatable and datarow types returned from the BLL is not so bad ??

              P Offline
              P Offline
              PIEBALDconsult
              wrote on last edited by
              #6

              As long as you access them via the BLL.

              1 Reply Last reply
              0
              Reply
              • Reply as topic
              Log in to reply
              • Oldest to Newest
              • Newest to Oldest
              • Most Votes


              • Login

              • Don't have an account? Register

              • Login or register to search.
              • First post
                Last post
              0
              • Categories
              • Recent
              • Tags
              • Popular
              • World
              • Users
              • Groups