C
C#2y ago
Messiah

❔ MVC models conflicting names

I'm consuming a big api from azure, and the child model classes I'm building have conflicting names after I paste classes as JSON. Example:
class Cats
{
public int size {get; set; }
public Skills skills {get; set;}
}
class Skills{ string blabla {get; set;}}

//other file
class Dogs
{
public int size {get; set;}
public Skills skills {get; set;}
}
class Skills{ string blabla {get; set;}}
class Cats
{
public int size {get; set; }
public Skills skills {get; set;}
}
class Skills{ string blabla {get; set;}}

//other file
class Dogs
{
public int size {get; set;}
public Skills skills {get; set;}
}
class Skills{ string blabla {get; set;}}
I only need the root node to be public, but it doesn't seem like a good solution to make the child nodes private since i'll need to access them at some point. Is there a way to make child nodes only accessible if I write out the root node name first?
3 Replies
Spixy
Spixy2y ago
hi, you mean that class Skills is there defined two times?
Anton
Anton2y ago
no the best you can do is nest Skills in the class it's used in
Accord
Accord2y ago
Was this issue resolved? If so, run /close - otherwise I will mark this as stale and this post will be archived until there is new activity.