Quantcast
Channel: ASP.NET Core
Viewing all articles
Browse latest Browse all 9386

Using list when build seed data

$
0
0

Hi,

I want to builf a seed data for my asp.net core project. I defined 3 objects, A, B & C.

A have list of B in its properties (ICollection) and B have list of C in its properties (ICollection) . 

In the seed data class, I wrote the following:

var a = new A()

{

b = new List<B>() {

c = new List<C>(){

}

}

}

The problem is that when I used "List" for B , visual studio recognized I want to use List and paint the keyword with green color.

When I tried the same for C, visual studio did the same, but when I tried to set C object properties, the "List" keyword was painted to white and visual studio didn't

recognize any of the C properties I tried to set. What cause the problem, after all I use the same technic both for B & C objects?


Viewing all articles
Browse latest Browse all 9386

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>