Click here to Skip to main content
15,895,848 members
Please Sign up or sign in to vote.
0.00/5 (No votes)
hello
i want to read some data from database with entity framework.
<img src="http://i.stack.imgur.com/AhRq6.png">
this picture is my entity framework classes. i have some classes that they are commensurate with my entity framework classes for transfer data between functions.
<img src="http://i.stack.imgur.com/FGuR3.png">


<img src="http://i.stack.imgur.com/s5e1Y.png">


now i want to read all rows from tblCenterShop and fill CenterShop classes with them.
my problem is that CenterShop classes contain a list of centerShopImage (images). pelase help me to fill images proprty of CenterShop class?
my function is in bellow :
C#
public IEnumerable<Model.CenterShop> GetAllCenterShops()
        {
            CenterShopSimulationEntities db = Repository.RepositoryManager.GetDB();
            return from c in db.tblCenterShop
                             select new Model.CenterShop
                             {
                                 ID = c.ID,
                                 address = c.address,
                                 category = new Model.CenterShopCat()
                                 {
                                     ID = c.tblCenterShopCat.ID,
                                     name = c.tblCenterShopCat.name
                                 },
                                 floorNumber = c.floorNumber,
                                 name = c.name,
                                 //images = ?????????,
                             };
        }

thanks.
Posted

This content, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)



CodeProject, 20 Bay Street, 11th Floor Toronto, Ontario, Canada M5J 2N8 +1 (416) 849-8900