Click here to Skip to main content
15,879,535 members
Articles / Desktop Programming / WPF

Building WPF Applications with Self-Tracking Entity Generator and Visual Studio 2012 - Project Setup

Rate me:
Please Sign up or sign in to vote.
5.00/5 (14 votes)
17 Mar 2013CPOL8 min read 68.3K   3.5K   44  
This article describes the project setup of building a WPF sample application with Self-Tracking Entity Generator and Visual Studio 2012.
using System;
using System.Collections.ObjectModel;
using System.ComponentModel;
using SchoolSample.EntityModel;

namespace SchoolSample.Common
{
    public interface ISchoolModel : INotifyPropertyChanged
    {
        // Data Retrieval:
        void GetStudentsAsync(ClientQuery clientQuery, string screenName);
        event EventHandler<ResultsArgs<Student>> GetStudentsCompleted;
        void GetStudentByIdAsync(int studentId);
        event EventHandler<ResultArgs<Student>> GetStudentByIdCompleted;

        void GetInstructorsAsync(ClientQuery clientQuery, string screenName);
        event EventHandler<ResultsArgs<Instructor>> GetInstructorsCompleted;
        void GetInstructorByIdAsync(int instructorId);
        event EventHandler<ResultArgs<Instructor>> GetInstructorByIdCompleted;

        void GetCoursesAsync(ClientQuery clientQuery, string screenName);
        event EventHandler<ResultsArgs<Course>> GetCoursesCompleted;
        void GetCourseByIdAsync(int courseId);
        event EventHandler<ResultArgs<Course>> GetCourseByIdCompleted;

        // Data Cache:
        ObservableCollection<Student> StudentsList { get; set; }
        Student CurrentStudent { get; set; }
        ObservableCollection<Instructor> InstructorsList { get; set; }
        Instructor CurrentInstructor { get; set; }
        ObservableCollection<Course> CoursesList { get; set; }
        Course CurrentCourse { get; set; }

        // Data Status:
        Boolean StudentsListHasChanges { get; }
        Boolean CurrentStudentHasChanges { get; }
        Boolean InstructorsListHasChanges { get; }
        Boolean CurrentInstructorHasChanges { get; }
        Boolean CoursesListHasChanges { get; }
        Boolean CurrentCourseHasChanges { get; }
        Boolean IsBusy { get; }

        // Update and Rollback of Entity List:
        void SaveStudentChangesAsync(bool allItems = true);
        event EventHandler<ResultArgs<string>> SaveStudentChangesCompleted;
        void RejectStudentChanges(bool allItems = true);

        void SaveInstructorChangesAsync(bool allItems = true);
        event EventHandler<ResultArgs<string>> SaveInstructorChangesCompleted;
        void RejectInstructorChanges(bool allItems = true);

        void SaveCourseChangesAsync(bool allItems = true);
        event EventHandler<ResultArgs<string>> SaveCourseChangesCompleted;
        void RejectCourseChanges(bool allItems = true);

        // Error Handling:
        Exception GetLastError();
        void ClearLastError();
        Boolean AllowMultipleErrors { get; set; }
    }
}

By viewing downloads associated with this article you agree to the Terms of Service and the article's licence.

If a file you wish to view isn't highlighted, and is a text file (not binary), please let us know and we'll add colourisation support for it.

License

This article, along with any associated source code and files, is licensed under The Code Project Open License (CPOL)


Written By
Software Developer (Senior)
United States United States
Weidong has been an information system professional since 1990. He has a Master's degree in Computer Science, and is currently a MCSD .NET

Comments and Discussions