0

I've only been working with Asp.Net MVC 3 for a few months now so fairly new to the MVC pattern. Have worked with .net and C# for years.

I am confused as the best way to go about creating the models needed for my situation. I am creating a news posting site and am working on the actual post data itself. I have a NPost table in the database that has the post's data like Title, Body, UserId, CreationDate, etc. I am also using the build in Forms Authentication with the tables auto generated for it as well as use with the profile properties for data such as name, and avatar picture.

You should also know I am using EntityFramework and Reverse Engineer Code First to generate the models I have been using so far.

My Question: How do I connect the post with the author?

Before I would have just joined the tables on the UserId in a stored proc and connected it with a control using a data source, but I am confused as the best way to do it in MVC.

Thanks for any and all help you can give me!

slugster
  • 49,403
  • 14
  • 95
  • 145
Adam Frick
  • 182
  • 1
  • 8
  • 1
    Your question has nothing to do with MVC, and is entirely Entity Framework related. Ironically, you included several mvc tags but not an EF one. – Erik Funkenbusch Sep 23 '12 at 02:40
  • I think you should look into a solution that allows you to use one database : http://stackoverflow.com/a/10264855/384701 – billy Sep 23 '12 at 02:53
  • @MystereMan Shows how much I know about how all of this works. – Adam Frick Sep 23 '12 at 03:04
  • @billy I am currently using one database. Both my Post Tables and the tables used for Form Authentication are in the same DB. – Adam Frick Sep 23 '12 at 03:27
  • Ok, so I think you're in "code first with existing database" mode : http://weblogs.asp.net/scottgu/archive/2010/08/03/using-ef-code-first-with-an-existing-database.aspx – billy Sep 23 '12 at 12:58
  • See [this answer](http://stackoverflow.com/a/12450829/861716) – Gert Arnold Sep 25 '12 at 15:05

0 Answers0