asp.net mvc - Entity Framework - stange behaviour -
i have 3 simplest tables:
http://magicscreenshot.blob.core.windows.net/screenshots/udywngovqem.jpg
and relationships among them:
http://magicscreenshot.blob.core.windows.net/screenshots/ztk28gbgkec.jpg
if create new project 0 , create entity model (from db) receive correct ef model:
http://magicscreenshot.blob.core.windows.net/screenshots/zzg8gpzxfke.jpg
but when try same real project - created ef model strange
http://magicscreenshot.blob.core.windows.net/screenshots/wfkgc8vbdu8.jpg
as can see, created new entity "sectionsite" relationship site , no relationship section. why happened , how fix it?
i able replicate if added in section , sectionsite table independently of adding site table. creates link following link.
to resolve missmatch of identity can either.
- remove , re-add site, section, , sectionsite @ same time.
or
- right click "add new association" between site , sectionsite , un-check "add foreign key properties 'section' entity."
- then need select created relationship, properties -> referential constraint , update meet fk relationship.
- once happy, right click , validate model , should work?
Comments
Post a Comment