Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • Home
  • SEARCH
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 5949739
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: May 22, 20262026-05-22T17:17:34+00:00 2026-05-22T17:17:34+00:00

I want to create a relationship between a custom table (Websites) and the default

  • 0

I want to create a relationship between a custom table (Websites) and the default aspnet tables related to Users.

I’m using code-first so for most FK relationships I would just do

public ModelName ModelName { get; set; }

With this, EF will automatically create the FK relationships. Very easy.

What’s confusing is the most effective way to hook into the aspnet users/membership table. Do I create a new model Users that acts as an interface so that I can implement custom user code?

Is there a best way to do this that fits well into EF best practices? I basically just want to relate a user to the Websites table/model so that EF can do its thing.

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-05-22T17:17:34+00:00Added an answer on May 22, 2026 at 5:17 pm

    This has few preconditions:

    • ASP.NET tables must be in the same database as your own tables
    • Previous precondition means that you must either create your database and tables manually (without automatic code-first generation) or you must use some custom initializer which will add non mapped ASP.NET tables as part of database recreation

    If you want your model class to have relation with ASP.NET table you must model ASP.NET table as another entity. I’m not sure if you can use ASP.NET classes for that because for example MembershipUser doesn’t have parameterless public constructor which is required for EF. So you will most probably need to create duplicate classes and their mappings and use these classes when referencing ASP.NET entities.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I want to create a MySQL table to hold relationship data between users. The
I have two tables, a and b, and want to create a m:n-relationship between
I have two tables that I'm trying to create a relationship between so I
My context model has a couple of related tables: CREATE TABLE CarSystem.Reads ( ReadId
I want to create a database in which there's an n x m relationship
I want to create a Java application bundle for Mac without using Mac. According
I am trying to set a foreign key relationship between an Order_Items table and
Using the Entity Framework Code First paradigm I have defined the following objects and
I have a standard many-to-many relationship between users and roles in my Rails app:
I want to create a new record in the mailers table, where three fields

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.