2

I am building a web application which will have a public facing piece with a forms login, and an internal piece with windows authentication login. The two projects will be using the same database. I would like to rely on Visual Studio tooling as much as possible, but do things the right way.

I was thinking of creating three projects in a single solution:

  1. Internal - ASP.Net MVC 4 Intranet application
  2. External - ASP.Net MVC 4 Internet application
  3. Models - just a class library

What is the best way to handle membership and database context? Move everything to the models class?

2
  • 1
    This depends on your requirements. Is authentication used for anything besides giving access to the application? As in, are your users tightly integrated into your data model? Commented May 22, 2013 at 14:15
  • Yes, I would tie the user id to other parts of the database/ Commented May 22, 2013 at 14:47

1 Answer 1

1

For your database access, you may be best placed to put all that configuration and your POCO classes (classes that represent your database tables) inside a Data project.

You could then put your Business logic and any other utilities inside a Core layer, this is what your Web will use to talk to the database (Core references Data).

Now, the structure of the Web side should probably just be one MVC project, you could separate both the Intranet and Extranet/External to be different Areas in that project.

To summarise:

  • YourApp.Data - Contains Database Configuration, POCO classes that correspond to Database tables. Also contains database CRUD methods.

  • YourApp.Core - References Data, wraps calls to the CRUD methods in Data inside appropriate Business Logic/Validation/Exception Handling etc.

  • YourApp.Web - References Core, makes call to Core methods to perform CRUD operations. Contains two Areas -> External and Intranet for each parts of your application.

Sign up to request clarification or add additional context in comments.

Comments

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.