c# - Application Design - Database Tables and Interfaces -
i have database tables each entity in system. e.g. persontable has columns personid, name, homestateid. there table 'reference data' (i.e. states, countries, currencies, etc.) data used fill drop down list boxes. reference table used persontable's homestateid foreign key reference table.
in c# application have interfaces , classes defined entity. e.g. personimplementationclass : ipersoninterface. reason having interfaces each entity because actual entity class store data differently depending on 3rd party product may change.
the question is, should interface have properties name, homestateid, , homestatename (which retrieved reference table). or should interface not expose structure of database, i.e. not have homestateid, , have name, homestatename?
i'd you're on right track when thinking property names!
model classes in real world.
forget database patterns , naming conventions of stateid , foreign keys in general. person has city, not cityid.
it'll data layer map , populate properties of objects @ run time. should have freedom express intent , representation of 'real world' objects in code, , not stuck db implementation.
Comments
Post a Comment