开发者

How add entity from table many to many

Create entity Desk:

var desk = new Desk()
           {
           x = Convert.ToInt32(Canvas.GetLeft(item)),
           y = Convert.ToInt32(Canvas.GetTop(item)),
           width = item.Width,
           height = item.Height,
           };

Add to table Desks:

m_RoomsContext.Desks.Add(desk);

And I need add desk.id and other id_room, but desk.id == 0.

m_RoomsContext.RoomToStandartDesks.Add(new RoomT开发者_StackOverflow社区oStandartDesk()
                       {
                           id_room = int.Parse(btnSave.Tag.ToString()),
                           id_desk = desk.id
                       }
                       );

How update desk ? or how to do it?


I think you're looking to update the changes to entities? If so:

m_RoomsContext.SaveChanges();
0

上一篇:

下一篇:

精彩评论

暂无评论...
验证码 换一张
取 消

最新问答

问答排行榜