We're working on a WPF app, that uses entity framework to access the data from a SQL Express database. In the XAML we have specified a resource like this:
<UserControl.Resources><CollectionViewSource x:Key="aSIGeneralViewSource" d:DesignSource="{d:DesignInstance {x:Type AsiEF:ASIGeneral}, CreateList=True}"/>
Then, within the user control's load event we have this:
private void UserControl_Loaded_1(object sender, System.Windows.RoutedEventArgs e) { asiContext = new ASIEntities(); //AsiEF is a class used for working with WCF services and the EF classes. AsiEF.LocalRemoteInterface remoteDB = new LocalRemoteInterface(); //retrieves data from the remote DB, puts it locally into the SQL Express DB remoteDB.GetAsiGeneral(true, ClientNumber, CaseNumber, true); System.Windows.Data.CollectionViewSource aSIGeneralViewSource = ((System.Windows.Data.CollectionViewSource)(this.FindResource("aSIGeneralViewSource"))); aSIGeneralViewSource.Source = asiContext.ASIGenerals.Where(c => c.ClientNumber == ClientNumber && c.CaseNumber == CaseNumber); }
OK, this works great for getting the data onto the user control, but now I want to save it. I had thought of moving the declaration of aSIGeneralViewSource out of the user control's load event, putting it at the class level, but the properties of aSIGeneralViewSource don't expose the SaveChanges() method that I would expect, for an entity framework implementation. What am I missing, here?
We're using entity framework for the data, so the ASIEntities is our EF object.
Rod