ComplexTypes和Associations [英] ComplexTypes and Associations
本文介绍了ComplexTypes和Associations的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!
问题描述
我数据库中的每个表都有4个重复字段,CreatedBy,CreatedOn,ModifiedBy和ModifiedOn。
Pretty much every table in my database has 4 recurring fields, CreatedBy, CreatedOn, ModifiedBy and ModifiedOn.
CreatedBy和ModifiedBy是int列,它们是User表的FK,指向创建或修改记录的用户。
CreatedBy and ModifiedBy are int columns that are FKs to the User table, pointing to the User that Created or Modified the record.
推荐答案
你好约翰,
据我所知,这种情况不受支持。当您将FK放入复杂类型时,关联仍然存在且导航属性仍然存在,但参考约束无法再找到FK属性。
如果RC最初是Product.CreatedByID- > Person.ID您希望能够将其更改为 Product.ComplexProperty.CreatedByID-> Person.ID,但这样做无效。 (我无论如何都忍不住尝试:))
可能有一些愚蠢的解决方法,但如果有,我不知道它可能是什么。也许团队成员可以明确地说"不"。
Hi John,
As far as I know this scenario is not supported. When you put the FKs into a complex type, the association still exists and the navigation proerties still exist, however the referential constraint can no longer find the FK property.
If the RC was originally Product.CreatedByID->Person.ID you would want to be able to change it to
Product.ComplexProperty.CreatedByID->Person.ID but that just doesn't work. (I couldn't help trying anyway :))
There could be some goofy workaround but if there is I have no clue what it might be. Maybe someone from the team can definitively say "NO".
这篇关于ComplexTypes和Associations的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!
查看全文