I've recently created a MVC 3 ASP.net application (using VB). I have also created forms validation by running aspnet_regsql
. I used this to create the table in the same database as my application uses. I am trying to work out how to create a new model, with a FK from the Users table. Do I have to reverse engineer the validation tables to create models in my application? right now, the tables only exist on the SQL 2008 database, as they were created by running the aspnet_regsql
command, and do not exists as models in my ASP.net solution. Here is the code I have now, for a model I would like to add a FK to (as a one-to-many relationship):
Imports System.Data.Entity
Imports System.ComponentModel
Imports System.ComponentModel.DataAnnotations
Imports System.Globalization
Public Class modelArtist
Public Property ID() As Integer
<Required()> _
<DataType(DataType.Text)> _
<Display(Name:="Artist Name:")> _
Public Property ArtistName() As String
<DataType(DataType.Text)> _
<Display(Name:="Artist Bio:")> _
Public Property ArtistBio() As String
<Display(Name:="")>
Public Property dateCreated() As Date
<Display(Name:="")> _
Public Property dateLastEdited() As Date
End Class
Public Class iDjItDBContext
Inherits DbContext
Public Property modelArtist() As DbSet(Of modelArtist)
End Class