Subsonic: Bring Me to Levels

This is an uncomfortable n-level core question.

I created a DAL project in VS2008 with subsonic. He got a widget class, a widgetcollection class, and a widgetcontroller control class.

I created a project of my business logic (no, I can’t put it at the same level) that refers to it. Using certain business criteria, he selects a collection of widgets in a function that returns a collection of widgets.

My question is: how does my GUI layer connect the collection to the grid? I know that widgetcollection is a valid data source for a datagrid, but how does the GUI layer know what a widget and widgetcollection are ? Of course, I do not need to refer to the DAL from the GUI, which negates the whole point.

+3
source share
4 answers

Firstly, I don’t think this is an uncomfortable n-level core question. This is a very interesting topic, and I tried to stimulate discussion on the old Subsonic forums.

I share your reluctance to expose your GUI layer to DAL.

My GUI layer only speaks to BLL using the vocabulary and themes from my own Entity Model and returns only my own entities or lists or, in some cases, data tables.

My BLL only talks about the MAPping layer, which displays Fetches, Saves, etc. for the corresponding methods, DAL CRUD and converts the returned Subsonic types to my Entity types.

, Subsonic , , , , .

, , BLL, , , , , Class , .

FWIW, , , , , , .

Rob , .

0

( SubSonic 2.x) BLL , DAL. BLL, DAL .BLL.DAL.xxxx

FWIW, SubSonic DataGridView. collection.ToTable() DataTable, , , , .AddRow()

0

IBindingList MSDN, . , , CustomersList , Customer BLL. CustomersList. .

0

You will probably need to use the interface. You can easily create an interface based on the widgets of your Dal (right-click on a class and create an interface from this class). Then grab the interface and add it to your business logic layer or standalone interface-only project. After that, you can add a link to the interface in both the DAL and the GUI. It can also help if you ever change the data store from database to XML, etc. Etc.

0
source

Source: https://habr.com/ru/post/1710540/


All Articles