I´m doing a small project for work, and I´m struggling a bit on how to create BLL objects in relation to the Database.
I have 2 questions (so far ...):
- How to represent foreign keys?
I would like to be able to use the instances for some logic (Ex: Shipment.Dispatcher.Name )), but in order to bound it to a control or update it I need the id.
- How to deal with master details?
With the example _items, should I make it public?, create a get only property? other way?
As an example I have 3 tables: Clients, Shipments and Items
I thought in doing it as you see below but I´m not feelling confident ...
What I have tried:
public class Shipment : INotifyPropertyChanged
private int _id;
private int _dispatcher_id;
private Client _dispatcher;
private List<Item> _items;
public int DispatcherID
_dispatcher = new Custom(value);
_dispatcher_id = _dispatcher.ID;
public Client Dispatcher
How would you do it?
Thank you for your time.