开发者

DataContext SubmitChanges

开发者 https://www.devze.com 2023-03-10 12:36 出处:网络
I am using LINQ-to-SQL. I have retrieved an Entity called FileType using FileTypeID from the respository. Now I have created an entity called ExportFile. ExportFile is a child of FileType.

I am using LINQ-to-SQL. I have retrieved an Entity called FileType using FileTypeID from the respository. Now I have created an entity called ExportFile. ExportFile is a child of FileType.

so here is what I have done:

var itemType = Repository.Current.ItemRepository.GetItemTypeByID(100);

Now I create a开发者_Go百科 ExportFile Entity as follows:

var exportItem = new Item() { GroupNumber = "000" };
itemType.Add(exportItem);

And then I do the following:

Repository.Current.SubmitAllChanges();

Now my question is: should ExportFile be added to the database or do we need to use the add entity of the dataContext explictly.

Thanks in advance!


DomainRepositoryManager.Current.SubmitAllChanges(); would be good to save the changes in the database.

0

精彩评论

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