sql server - Entity Framework inheritance and many to many mapping -


this tehnically 2 problems think allready know solution first i'll post here check.

i'm using entity framework 6, , building model database first way. in database significan interactions (inserting , modifying) handled through stored procedures (mainly can additional database side perimision checks).

first problem i'm trying build school's database. have 2 tables profesors , students. have aditional tabla called personaldata contains personal data info names, surnames , such. profesor , student tables in 1:0.1 relationships personaldata, meaning every single profesor there has personaldata record. same students. not every record in personaldata must student or profesor, of them parents.

at first tried implement in ef tpt inheritance, problems may arise if student becomes @ point professor. due way ef handles inheritance personaldata collection contain 2 entities same id.

i have googled bit , have found out using inheritance in these kind of cases impossible, , i'll need go accessing personal data throgh relationships, cause possible problem due fact i'll have manually make sure personalrecord added every student/professor. unless has better idea?

second problem due fac i'm using stored procedures inserting , updating data. have fiew many many relationships in db, , when import tables many many related, see no way map relationship (it's table) procedure.

so know how map many many relationships stored procedures in model designer?

as many many mapping stored procedures, seems it's impossible now. can attach instead of triggers join table, or view representing table. methid using view causes problems since ef treats views readonly, you'll need manually edit emdx , change view's type view table. make ef treat view table. if using view method, ef model designer won't turn view representing cross table association automatically. you'll have add assoc manually, map manually , delete view entity doesn't cause error since 2 things mapping same object (association , entity).


Comments

Popular posts from this blog

java - WrongTypeOfReturnValue exception thrown when unit testing using mockito -

php - Magento - Deleted Base url key -

android - How to disable Button if EditText is empty ? -