开发者

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

开发者 https://www.devze.com 2022-12-20 22:20 出处:网络
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 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 autopers开发者_StackOverflow中文版istence 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?


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.

0

精彩评论

暂无评论...
验证码 换一张
取 消

关注公众号