开发者

vs2010 Linq to SQL -- adding an entity from my DBML

开发者 https://www.devze.com 2022-12-15 07:35 出处:网络
I think I may be going crazy here... Anyways, I have a DBML with a table \'User\' in it. Pretty simple stuff --

I think I may be going crazy here...

Anyways, I have a DBML with a table 'User' in it. Pretty simple stuff -- From within a class, I have the following:

BusinessDataContext businessDataContext = new BusinessDataContext();

var user = new User();
user.FirstName = FirstName;
user.LastName = LastName;
user.MiddleInitial = MiddleInitial;
user.DateCreated = DateTime.UtcNow;

/*
  There's no businessDataContext.User.Add method -- 
  There's a bunch of generic collectio开发者_如何学JAVAn methods with the <> symbols 
  (Aggregate, All, Any...)
  Am I just too tired and missing something basic 
  or did something simple change with vs 2010?
*/

businessDataContext.SubmitChanges();

I think I really just need sleep. :-)


InsertOnSubmit? i.e. businessDataContext.User.InsertOnSubmit(user); or businessDataContext.Users.InsertOnSubmit(user);?

0

精彩评论

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