How to add extra field in the ManyToMany generated table with FluentNHibernate

不打扰是莪最后的温柔 提交于 2019-12-10 22:28:04

问题


I have 2 entities Users and Colors. One user may be associated with multiple colors, and one color may be associated with multiple users. I use FluentNHibernate autopersistence model to generate the database. Now I have to add to the generated table UserToColor(UserId,ColorId) also an extra field 'CreatedOn', how can I accomplish and is this accomplishable with fluent-nhibernate?


回答1:


NHibernate doesn't support this. The best workaround is to create an extra class as a link table, and have a many to one relationship to it from each of your existing classes.



来源:https://stackoverflow.com/questions/2281648/how-to-add-extra-field-in-the-manytomany-generated-table-with-fluentnhibernate

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!