locked
Ria, Code first, many to many, inserts! RRS feed

  • Question

  • I've created my pocos , the EF is correctly creating my mapping table. In one to many relationships the entity has a property for its one to many collections - So why, oh why, doesn't the entity with a many to many relationships create a property on the many to many entity that allows me to see the mappings. And more to the point how am i supposed to insert new mappings in.

        public class CategoryDto
        {
            [Key]
            Guid CategoryId { get; set; }
    
            public List<ProductDto> Products { get; set; }
      
            public List<CategoryItemDto> CategoryItems { get; set; }
        }
    
        public class  CategoryItemDto
        {
            [Key]
            public Guid CategoryItemDtoId{get;set;}
      
            Guid CategoryId { get; set; }
    
        }
    
        public class ProductDto
        {
            [Key]
            Guid ProductId { get; set; }
    
            public List<CatagoryDto> Categories { get; set; }
    
        }
    
        //
        // This is auto generated code 
        //
        public class CategoryDtoEntity  :  Entity
        {
            Guid CategoryId { get; set; }
    
            public EntityCollection<CategoryItemDto> CategoryItemDtos  {get;set;}
    
            // where is the many to many collection & likewise where is its 
            // corresponding Property on the Producs table?
            // public EntityCollection<ProductDto> Categories { get; set; }
      
        }
    

    Thanks in advance,

    Yours(really getting cheesed off ;))

    MK

     

     


    • Edited by Kelbob Monday, February 6, 2012 4:43 PM
    Monday, February 6, 2012 11:05 AM

Answers

All replies