Skip to main content
All docs
V24.2

DevExpress v24.2 Update — Your Feedback Matters

Our What's New in v24.2 webpage includes product-specific surveys. Your response to our survey questions will help us measure product satisfaction for features released in this major update and help us refine our plans for our next major release.

Take the survey Not interested

AppointmentCRUDEventArgs.UpdateInSource Property

Returns the list of appointments to update in the data source.

Namespace: DevExpress.Xpf.Scheduling

Assembly: DevExpress.Xpf.Scheduling.v24.2.dll

NuGet Package: DevExpress.Wpf.Scheduling

#Declaration

public IReadOnlyList<AppointmentItem> UpdateInSource { get; }

#Property Value

Type Description
IReadOnlyList<AppointmentItem>

A list of DevExpress.Xpf.Scheduling.AppointmentItem objects that have been changed in the scheduler.

#Remarks

When a user updates or deletes a pattern, the scheduler deletes all ChangedOccurrence and DeletedOccurrence appointments for the corresponding recurring series. The Occurrence appointments are not stored in any collection to avoid a stack overflow for infinite recurring series. These appointments are automatically generated at runtime based on the pattern’s AppointmentItem.RecurrenceInfo property.

When a user updates a pattern, the scheduler only adds the pattern appointment to the UpdateInSource and Appointments lists. The ChangedOccurrence and DeletedOccurrence appointments are added to the DeleteFromSource list.

When a user modifies or deletes an Occurrence appointment, the scheduler adds the corresponding exception (ChangedOccurrence or DeletedOccurrence) to the AddToSource and Appointments lists.

The code snippet below adds appointments to the data source.

// data context
public class SchedulingContext : DbContext {
    public SchedulingContext() : base(CreateConnection(), true) { }
    static DbConnection CreateConnection() {
        //...
    }
    public DbSet<AppointmentEntity> AppointmentEntities { get; set; }
    public DbSet<ResourceEntity> ResourceEntities { get; set; }
}

// save changes to the data source
public void ProcessChanges(AppointmentCRUDEventArgs args) {
    using(var dbContext = new SchedulingContext()) {

        foreach(var appt in args.UpdateInSource.Select(x => (AppointmentEntity)x.SourceObject))
            AppointmentEntityHelper.CopyProperties(appt, dbContext.AppointmentEntities.Find(appt.Id));

        dbContext.SaveChanges();
    }
}

Tip

If you do not initialize a new dbContext each time you call the ProcessChanges method, you do not need to use the UpdateInSource to update the source explicitly. You only need to call the dbContext.SaveChanges method.

See Also