Click here to Skip to main content
15,889,281 members
Home / Discussions / Visual Basic
   

Visual Basic

 
GeneralRe: String issue Pin
Richard MacCutchan20-Apr-13 9:27
mveRichard MacCutchan20-Apr-13 9:27 
GeneralRe: String issue Pin
SPSandy20-Apr-13 16:21
SPSandy20-Apr-13 16:21 
AnswerRe: String issue Pin
Alan N20-Apr-13 14:16
Alan N20-Apr-13 14:16 
GeneralRe: String issue Pin
SPSandy20-Apr-13 19:58
SPSandy20-Apr-13 19:58 
QuestionStored Procedures Pin
alecxa0518-Apr-13 17:58
alecxa0518-Apr-13 17:58 
AnswerRe: Stored Procedures Pin
Richard MacCutchan18-Apr-13 23:07
mveRichard MacCutchan18-Apr-13 23:07 
AnswerRe: Stored Procedures Pin
RedDk21-Apr-13 12:52
RedDk21-Apr-13 12:52 
QuestionHow to do this Relationship in Entity Framework using DataAnnotation not Fluent API Pin
ADSCNET18-Apr-13 16:01
ADSCNET18-Apr-13 16:01 
Dear All,
I have 6 tables created from a class using EF Code First approach, and I'm wondering how to do the relationship between the tables using DataAnnotation, classes as follow:
XML
Imports System
Imports System.Collections.Generic
Imports System.Linq
Imports System.Web

Imports System.ComponentModel.DataAnnotations
Imports System.ComponentModel.DataAnnotations.Schema

Public Class Customer
    <Key, ScaffoldColumn(False)>
    Public Property CustomerID() As Integer

    <Display(Name:="File No"), StringLength(6)>
    Public Property CustomerFileNo() As String

    <Required(ErrorMessage:="First Name is required")>
    <Display(Name:="First Name"), StringLength(20)>
    Public Property FirstName() As String

    <Display(Name:="Last Name"), StringLength(20)>
    Public Property LastName() As String

    <Display(Name:="Street"), StringLength(40)>
    Public Property Addr_StreetName() As String

    <DefaultSettingValue("0")>
    Public Property MaritalStatusID() As Integer

    <DefaultSettingValue("0")>
    Public Property Addr_AreaID() As Integer

    <DefaultSettingValue("0")>
    Public Property Wrk_OccupationID() As Integer
End Class

Public Class MaritalStatus
    <Key, ScaffoldColumn(False)>
    Public Property MaritalStatusID() As Integer

    <Required(ErrorMessage:="Name Required")>
    <Display(Name:="Marital Status"), StringLength(10)>
    Public Property MaritalName() As String

    <DefaultSettingValue("1")>
    Public Property RecStatus() As Boolean
End Class

Public Class Area
    <Key, ScaffoldColumn(False)>
    Public Property AreaID() As Integer

    <Required(ErrorMessage:="Name Required")>
    <Display(Name:="Area Name"), StringLength(30)>
    Public Property AreaName() As String

    <DefaultSettingValue("1")>
    Public Property RecStatus() As Boolean
End Class

Public Class Occupation
    <Key, ScaffoldColumn(False)>
    Public Property OccupationID() As Integer

    Public Property OccupationName() As String
End Class

Public Class InvoiceHdr
    <Key, ScaffoldColumn(False)>
    Public Property InvoiceID() As Integer

    Public Property InvoiceNo() As String
    Public Property Amount() As Integer

    Public Property CustomerID As Integer
End Class

Public Class InvoiceDetails
    <Key, ScaffoldColumn(False)>
    Public Property InvoiceDetailsID() As Integer

    Public Property InvoiceID() As String
    Public Property ItemNo() As String
    Public Property ItemDescription() As String
End Class

Description:
Customer table has fields:
- MaritalStatusID which linked to MaritalStatus master table, and displayed as drop downlist in the customer formview
- Addr_AreaID which linked to Area master table, and displayed as drop downlist in the customer formview
- Wrk_OccupationID which linked to Occupation master table, and displayed as drop downlist in the customer formview

Then Invoice table has:
- CustomerID which linked to the customer table

Then InvoiceDetails table has:
- InvoiceID which is linked to Invoice table.

Thanks in advance
AnswerRe: How to do this Relationship in Entity Framework using DataAnnotation not Fluent API Pin
Richard MacCutchan18-Apr-13 23:03
mveRichard MacCutchan18-Apr-13 23:03 
GeneralRe: How to do this Relationship in Entity Framework using DataAnnotation not Fluent API Pin
ADSCNET19-Apr-13 0:26
ADSCNET19-Apr-13 0:26 
GeneralRe: How to do this Relationship in Entity Framework using DataAnnotation not Fluent API Pin
Richard MacCutchan19-Apr-13 0:45
mveRichard MacCutchan19-Apr-13 0:45 
GeneralRe: How to do this Relationship in Entity Framework using DataAnnotation not Fluent API Pin
ADSCNET19-Apr-13 0:47
ADSCNET19-Apr-13 0:47 
QuestionDouble monitor Pin
NicoTexas17-Apr-13 6:12
NicoTexas17-Apr-13 6:12 
AnswerRe: Double monitor Pin
Eddy Vluggen18-Apr-13 10:28
professionalEddy Vluggen18-Apr-13 10:28 
QuestionVB 2010 : How to make regular appointment using ListView & MonthCalendar? Pin
Yazid Aura Robbani15-Apr-13 12:15
professionalYazid Aura Robbani15-Apr-13 12:15 
AnswerRe: VB 2010 : How to make regular appointment using ListView & MonthCalendar? Pin
Eddy Vluggen17-Apr-13 5:09
professionalEddy Vluggen17-Apr-13 5:09 
GeneralRe: VB 2010 : How to make regular appointment using ListView & MonthCalendar? Pin
Yazid Aura Robbani18-Apr-13 10:00
professionalYazid Aura Robbani18-Apr-13 10:00 
QuestionRe: VB 2010 : How to make regular appointment using ListView & MonthCalendar? Pin
Eddy Vluggen18-Apr-13 10:33
professionalEddy Vluggen18-Apr-13 10:33 
AnswerRe: VB 2010 : How to make regular appointment using ListView & MonthCalendar? Pin
Yazid Aura Robbani19-Apr-13 3:06
professionalYazid Aura Robbani19-Apr-13 3:06 
GeneralRe: VB 2010 : How to make regular appointment using ListView & MonthCalendar? Pin
Eddy Vluggen19-Apr-13 6:41
professionalEddy Vluggen19-Apr-13 6:41 
GeneralRe: VB 2010 : How to make regular appointment using ListView & MonthCalendar? Pin
Yazid Aura Robbani21-Apr-13 4:11
professionalYazid Aura Robbani21-Apr-13 4:11 
GeneralRe: VB 2010 : How to make regular appointment using ListView & MonthCalendar? Pin
Eddy Vluggen21-Apr-13 8:32
professionalEddy Vluggen21-Apr-13 8:32 
GeneralRe: VB 2010 : How to make regular appointment using ListView & MonthCalendar? Pin
Yazid Aura Robbani21-Apr-13 17:34
professionalYazid Aura Robbani21-Apr-13 17:34 
QuestionHow to get a string pointer in VB for CE Pin
Member 989133415-Apr-13 1:51
Member 989133415-Apr-13 1:51 
AnswerRe: How to get a string pointer in VB for CE Pin
Eddy Vluggen15-Apr-13 7:33
professionalEddy Vluggen15-Apr-13 7:33 

General General    News News    Suggestion Suggestion    Question Question    Bug Bug    Answer Answer    Joke Joke    Praise Praise    Rant Rant    Admin Admin   

Use Ctrl+Left/Right to switch messages, Ctrl+Up/Down to switch threads, Ctrl+Shift+Left/Right to switch pages.