asp.net - Consolidate/Merge data from TWO IEnumerable Lists into ONE -


i have following domain objects in application:

 [serializable]     public class supplier     {         public virtual string suppliertype { get; set; }         public virtual string suppliercode { get; set; }          public virtual string name { get; set; }         public virtual string description { get; set; }         public virtual string rating { get; set; }         public virtual string websiteurl { get; set; }          public virtual ilist<address> address { get; set; }      }      [serializable]     public class cargosupplier : supplier     {         public virtual ilist<image> images { get; set; }         public virtual string openingtime { get; set; }         public virtual string closingtime { get; set; }          public virtual ilist<product> products { get; set; }     } 

i have goto 2 seperate repositories getting descriptive content (from database) , pricing (from external webservice) , have 2 seperate enumerations populated data (descriptive content & pricing):

ienumerable<cargosupplier> cargosuppliers_pricing ienumerable<cargosupplier> cargosuppliers_content 

cargosuppliers_content have fields populated data except ilist<product> , cargosuppliers_pricing have suppliertype, suppliercode , ilist<product> fields populated data. combination of "suppliertype" amd "suppliercode" key.

now have merge content , pricing 1 enumeration can return ienumerable<cargosupplier> cargosuppliers controllers & views. best way merge/consolidate these 2 lists one?

it sounds don't want 1 list contains items in either list - sounds need merge individual items. this:

var query = pricing in cargosuppliers_pricing             join content in cargosuppliers_content             on pricing.suppliercode equals content.suppliercode             select new cargosupplier             {                 // copy properties both objects here             }; 

within "select" part take pricing parts "pricing" , content parts "content", building cargosupplier object has both bits.

is after?


Comments

Popular posts from this blog

java - SNMP4J General Variable Binding Error -

windows - Python Service Installation - "Could not find PythonClass entry" -

Determine if a XmlNode is empty or null in C#? -