خرید بک لینک

Vote count: 0

Spell spell = db.Spells.Where(x=>x.Id == spellId).FirstOrDefault();

Above, I am calling the database to get a list of Spells where the id matches what's sent in by the user.

The spell class looks like this:

public partial class Spell
{
    public int Id { get; set; }

    [Required]
    [StringLength(50)]
    public string Name { get; set; }

    public string Description { get; set; }

    [StringLength(50)]
    public string Page { get; set; }

    [StringLength(50)]
    public string Range { get; set; }

    [StringLength(50)]
    public string Components { get; set; }

    public bool? Ritual { get; set; }

    [StringLength(50)]
    public string Duration { get; set; }

    public bool? Concentration { get; set; }

    [StringLength(50)]
    public string CastingTime { get; set; }

    public int Level { get; set; }

    [StringLength(50)]
    public string School { get; set; }

    [Required]
    [StringLength(100)]
    public string Classes { get; set; }

    [StringLength(100)]
    public string Archetype { get; set; }

    [StringLength(50)]
    public string Domains { get; set; }

    [StringLength(50)]
    public string Oaths { get; set; }

    [StringLength(50)]
    public string Circles { get; set; }
}

However, when that line executes, I get an error that spellbook_id is not a column.

I checked the query that's executing, and this is it:

SELECT 
[Extent1].[Id] AS [Id], 
[Extent1].[Name] AS [Name], 
[Extent1].[Description] AS [Description], 
[Extent1].[Page] AS [Page], 
[Extent1].[Range] AS [Range], 
[Extent1].[Components] AS [Components], 
[Extent1].[Ritual] AS [Ritual], 
[Extent1].[Duration] AS [Duration], 
[Extent1].[Concentration] AS [Concentration], 
[Extent1].[CastingTime] AS [CastingTime], 
[Extent1].[Level] AS [Level], 
[Extent1].[School] AS [School], 
[Extent1].[Classes] AS [Classes], 
[Extent1].[Archetype] AS [Archetype], 
[Extent1].[Domains] AS [Domains], 
[Extent1].[Oaths] AS [Oaths], 
[Extent1].[Circles] AS [Circles], 
[Extent1].[Spellbook_Id] AS [Spellbook_Id]
FROM [dbo].[Spells] AS [Extent1]

As you can see, somehow EF is requesting a Spellbook_Id from the table, but it doesn't exist. I'm not sure where it's getting that idea. I do have a Spellbook class, which just has an id, a userid, and a List, but the query I'm trying to run shouldn't be referencing Spellbook at all, and there are no foreign key constraints on dbo.Spells

asked 1 min ago

برچسب: نویسنده: استخدام کار تاريخ: يکشنبه 26 ارديبهشت 1395 ساعت: 2:24

صفحه بندی