This question is locked. New answers and comments are not allowed.
hi,
i am stll learning all thjese ORM concepts so ...
in my wpf application i have a datagrid bound to a collectionviewsource,
i am inserting records with a modal window with this code
if tried this code just after the savechange() method
but i has no effect, i have to close the form and open it to see the changes .
please note that i am using the same context via ContextFactory.ObtainContext() like suggested .
and using this code to populate my datagrid
any help is welcome
thanks and good day
i am stll learning all thjese ORM concepts so ...
in my wpf application i have a datagrid bound to a collectionviewsource,
i am inserting records with a modal window with this code
EditPatientForm ep =
new
EditPatientForm();
PATIENT p =
new
PATIENT();
ep.DataContext = p;
if
(ep.ShowDialog() ==
true
)
if
(ep.DialogResult ==
true
)
{
var _context = ContextFactory.ObtainContext();
_context.Add(p);
_context.SaveChanges();
}
if tried this code just after the savechange() method
System.Windows.Data.CollectionViewSource patientsViewSource =
((System.Windows.Data.CollectionViewSource)(
this
.FindResource(
"pATIENTViewSource"
)));
patientsViewSource.View.Refresh();
please note that i am using the same context via ContextFactory.ObtainContext() like suggested .
and using this code to populate my datagrid
private
void
UserControl_Loaded(
object
sender, RoutedEventArgs e)
{
if
(!System.ComponentModel.DesignerProperties.GetIsInDesignMode(
this
))
{
System.Windows.Data.CollectionViewSource patientsViewSource =
((System.Windows.Data.CollectionViewSource)(
this
.FindResource(
"pATIENTViewSource"
)));
var _context = ContextFactory.ObtainContext();
patientsViewSource.Source = _context.PATIENTs.ToList();
}
}
any help is welcome
thanks and good day