DataClasses1DataCont ext oldContext new DataClasses1DataCont ext DataC

 1
 2
 3
 4
 5
 6
 7
 8
 9
10
11
12
13
14
15
DataClasses1DataContext oldContext = new DataClasses1DataContext();
DataClasses1DataContext newContext = new DataClasses1DataContext();
Function function = (from f in oldContext.Functions where f.Id == new Guid("325522ce-d42c-4ab5-9b1d-600e6d760075") select f).FirstOrDefault();
function.FunctionType = (from f in newContext.FunctionTypes where f.Id == function.FunctionType.Id select f).FirstOrDefault();
oldContext.Dispose();
oldContext = null;
newContext.Functions.Attach(function);
function.BeginDate = DateTime.Now;
function.Note = "88";
newContext.Functions.GetModifiedMembers(function);
newContext.SubmitChanges();