.net - Don't generate db but map to existing tables -
we'd use model first generate clean ef models our application instead of having model generate new db schema we'd manually table mapping within entity existing database table or tables. there mechanism this?
sure is.
this called entity framework code-first , good tutorial getting started.
the idea create poco classes seperate repository/database class. in repository/database class, define relationships between poco's. fortunately, entity framework has number of conventions can leverage off, means might not need define every relationship , rule.
eg. if class called user
, assume (by default, unless override this) database table called users
, primary key identity field in poco userid
, same in database table.
Comments
Post a Comment