I’m trying to add a foreign key reference to the aspnet_users table to my Users table, to simply extend the aspnet_users. I’m using EF and I don’t want to create an aspnet_users entity class. Is there a way to use the fluent API to create a foreign key reference to a table the EF isn’t currently tracking?
I know it’s not fluent API, but I tried the following w/ obvious fail:
[ForeignKey("aspnet_users.UserId")]
Thanks.
This is not possible with fluent API either. You will have to execute the SQL manually to create the FK. If you are using database initializer then you can try something like this.