An unhandled exception occurred while processing the request
InvalidOperationException: The entity type 'myModel' requires a primary
key to be defined. If you intended to use a keyless entity type , call
'HasNoKey' in OnModelCreating
Keyless entity types
Lösung:
Wort [Key] vor die ID der Tabelle einfügen
[Key]
public int Idcontent { get; set; }
|
using System;
using System.Collections.Generic;
using System.ComponentModel.DataAnnotations;
#nullable disable
namespace CodeDocu.Models
{
public partial class ContentModel
{
//-------------<
Class: Model_Project >-------------
#region Variables
//------------<
Region: Variables >------------
//[Required]
[Key]
public int Idcontent { get; set; }
public string Title { get; set; }
public string TextContent { get; set; }
public string HtmlContent { get; set; }
public string Folder { get; set; }
public string Keywords { get; set; }
|