0

I'd like to create a dto that has a collection of reference id's to the object that is stored in a collection in the entity. As illustrated below:

public class MainEntity{
   public int Id {get;set;}
   public ICollection<OtherEntity> Others {get;set;}
}
public class OtherEntity {
   public int Id {get;set;}
   // a whole bunch of other properties I can get by reference if I need.
} 

What I'd like to accomplish is:

public class MainDto {  
   public int Id {get;set}
   public ICollection<int> Others {get;set;}
   /* in this case, the property Others 
    would be a reference to the Other entity Ids in the list */
}

I've played with this for awhile, and every time I think I'm getting somewhere, something collapses. Any help is appreciated.

dgo
  • 3,877
  • 5
  • 34
  • 47

0 Answers0