Question

Example error; I try to *Scaffold Controller Region -Repository* Example error; I try to Scaffold Controller Region -Repository

Region class

public class Region
{
    public int RegionId { get; set; }

    public string RegionCode { get; set; }
    public string ApiUrl { get; set; }

    public Universe[] Universes { get; set; }
}

The error repeats essentially for each file it tries to generate (the views, mostly).

I'm not sure what information to include other than this, because I have no clue what causes it. I've tried searching for a solution, but most solutions seems unrelated to my particular issue.

Was it helpful?

Solution

What I will suggest to you is to replace the Array by a List or better an generic interface ICollection. And then try again. Working with array you need to intialize it in the constructor.

   public class Region
  {
    public int RegionId { get; set; }

    public string RegionCode { get; set; }
    public string ApiUrl { get; set; }

    public ICollection<Universe> Universes { get; set; }
   }

OTHER TIPS

I solved the problem immediately after submitting with a last-resort option.

I changed:

public Universe[] Universes { get; set; }

To:

public ICollection<Universe> Universes { get; set; }

Then I ran the Scaffold command again, and it worked perfectly. Strange!

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top