In EF4 is it possible to have a referential contstraint which is based upon just a substring of a value?
e.g.
Ref table:
Code: varchar(5)
Desc: varchar(50)
Main Table:
Code: varchar(6)
Data1:
Data2: etc…
I would like to have a constraint where MainTable.Code.Substring(0,5) > RefTable.Code
Is that possible?
No this is not possible and I doubt that you can create such relation in database – EF follows same rules as relational database.
Edit: Actually there can be a way to achieve that if you try to represent it as a query inside QueryView.