How can I edit or add to a particular field without pull the all object

后端 未结 2 1977
Happy的楠姐
Happy的楠姐 2021-01-26 10:45
  1. How I can do just this ( a.myFavorits.Add()) without pulling the all object to var a , because a has a lot of data, and I don\'t

2条回答
  •  陌清茗
    陌清茗 (楼主)
    2021-01-26 10:52

    I'm guessing this is what you want? I don't see you 'editting' I only see you adding.

    using (var db = dataBase())
    {
        var a = new user(); 
         .... 
         //set properties etc..
         ...
        a.myFavorits.Add(new BE.FavoritsUsersLong { myLong = f });
        db.users.Add(a);
        db.SaveChanges(); 
    }
    

提交回复
热议问题