entity framework - Why can't I have a referential constraint with a one to zero-to-one association? -


i'm using entity framework 4.3 model first , can't figure out why i'm not allowed have 1 zero-to-one association along referential constraint.

i have 2 main problems. can't force referential integrity (without manual intervention) , lazy loading doesn't seem work... 1 many associations fine.

i have 2 tables, loans , contracts. contracts table has scalar field loanid.

until loan submitted, not have contract data , chose not place in same table due size of contract data. ie. don't want contract data retrieved database unless required.

i've searched around , can't seem find model first information answers questions. information may me understand , clarify problem appreciated.

regards craig

i guess loanid field not primary key in contracts table. in such case cannot have such one-to-one relation because ef doesn't support it. when create loanid field in contracts table way force one-to-one relation add unique constraint on field. ef doesn't support unique keys (except primary keys) way create one-to-one relation create relation between primary keys (loan.id <-> contract.id). if don't follow error in designer.


Comments

Popular posts from this blog

c# - SVN Error : "svnadmin: E205000: Too many arguments" -

c# - Copy ObservableCollection to another ObservableCollection -

All overlapping substrings matching a java regex -