Frage

Bitte entschuldigen Sie die ungeschickte Frage (wenn Sie eine bessere Art und Weise zu Wort herauszufinden, kann die Frage fühlen Sie sich frei zu bearbeiten entfernt).

Ich habe zwei Klassen SupportTicketCategory und Kundensupport (jeweils):

   public class SupportTicketCategory
{
    public SupportTicketCategory()
    { }

    private int _supportTicketCategoryID;
    public virtual int SupportTicketCategoryID
    {
        get { return _supportTicketCategoryID; }
        set
        {
            _supportTicketCategoryID = value;
        }
    }

    private string _supportTicketCategoryName;
    public virtual string SupportTicketCategoryName
    {
        get { return _supportTicketCategoryName; }
        set
        {
            _supportTicketCategoryName = value;
        }
    }


}

und

     public SupportTicket()
    { }

    private int _supportTicketID;
    public virtual int SupportTicketID
    {
        get { return _supportTicketID; }
        set
        {
            _supportTicketID = value;
        }
    }

    private SupportTicketCategory _supportTicketCategory;
    public virtual SupportTicketCategory SupportTicketCategory { get; set; }

Meine Tabellenstruktur ist wie folgt:

CREATE TABLE [dbo].[supporttickets](
[supportticketid] [int] IDENTITY(1,1) NOT NULL,
[supportticketcategoryid] [int] NOT NULL,
 CONSTRAINT [PK_supporttickets] PRIMARY KEY CLUSTERED 
(
    [supportticketid] ASC
)
) ON [PRIMARY]

ALTER TABLE [dbo].[supporttickets]  
WITH CHECK ADD CONSTRAINT
[FK_supporttickets_supportticketcategories] 
FOREIGN KEY([supportticketcategoryid])
REFERENCES [dbo].[supportticketcategories] ([supportticketcategoryid])

ALTER TABLE [dbo].[supporttickets] CHECK CONSTRAINT  [FK_supporttickets_supportticketcategories]

CREATE TABLE [dbo].[supportticketcategories](
    [supportticketcategoryid] [int] IDENTITY(1,1) NOT NULL,
    [supportticketcategoryname] [varchar](50) NOT NULL,
 CONSTRAINT [PK_supportticketcategories] PRIMARY KEY CLUSTERED 
(
    [supportticketcategoryid] ASC
)
) ON [PRIMARY]

Also im Grunde möchte ich einen SupportTicketCategory auf den Kundensupport abzubilden, wie es in meiner Klasse ist, aber ich kann nicht herausfinden, was der richtige Mapping-Typ ist und nicht ein Beispiel dafür auf dem interwebs finden.

Update: Ich habe die SupportTicketCategory Eigenschaft der alten Schule Getter und Setter und es funktionierte ... Syntax Zucker für den Verlust.

scroll top