Click here to Skip to main content
Click here to Skip to main content
Add your own
alternative version

Building WPF Applications with Self-Tracking Entity Generator - Project Setup

, 20 Feb 2012
This article describes the project setup of building a WPF sample application with Self-Tracking Entity Generator for WPF/Silverlight.
SchoolSample_20111201.zip
SchoolSample
Local.testsettings
SchoolSample.vsmdi
TraceAndTestImpact.testsettings
Assemblies
GalaSoft.MvvmLight.Extras.WPF4.dll
GalaSoft.MvvmLight.WPF4.dll
Moq.dll
System.Windows.Interactivity.dll
WPFToolkit.Extended.dll
ComponentModel.Composition.Initialization.Desktop
Microsoft
ComponentModel
Composition
Hosting
Internal
Properties
System
ComponentModel
Composition
Hosting
System.Windows.Controls.Data.Input
Common
Properties
Settings.settings
themes
Validation
Database
SchoolSample
SchoolSample.csproj.user
Asset
Control
Properties
Settings.settings
View
SchoolSample.Common
Model
Properties
Resource
SchoolSample.Data
EntityModel
Properties
Validation
SchoolSample.Data.Wcf
EntityModel
SchoolModel.edmx
Properties
Validation
SchoolSample.Model
Properties
SchoolSample.ViewModel
Properties
SchoolSample.Wcf
SchoolSample.Wcf.csproj.user
Properties
Service
SchoolService.svc
SchoolSample.WCFService
SchoolSample.WCFService.csproj.user
Properties
Service References
SchoolService
configuration.svcinfo
configuration91.svcinfo
Reference.svcmap
SchoolService.disco
SchoolService.wsdl
Test.SchoolSample.Model
Properties
Test References
SchoolSample.Model.accessor
Test.SchoolSample.ViewModel
Properties
Test References
SchoolSample.ViewModel.accessor
SchoolSample_20120117.zip
Local.testsettings
SchoolSample.vsmdi
TraceAndTestImpact.testsettings
GalaSoft.MvvmLight.Extras.WPF4.dll
GalaSoft.MvvmLight.WPF4.dll
Moq.dll
System.Windows.Interactivity.dll
WPFToolkit.Extended.dll
Settings.settings
SchoolSample.csproj.user
Settings.settings
SchoolModel.edmx
SchoolSample.Wcf.csproj.user
SchoolService.svc
SchoolSample.WCFService.csproj.user
configuration.svcinfo
configuration91.svcinfo
Reference.svcmap
SchoolService.disco
SchoolService.wsdl
SchoolSample.Model.accessor
SchoolSample.ViewModel.accessor
SchoolSample_20120216.zip
Local.testsettings
SchoolSample.vsmdi
TraceAndTestImpact.testsettings
GalaSoft.MvvmLight.Extras.WPF4.dll
GalaSoft.MvvmLight.WPF4.dll
Moq.dll
System.Windows.Interactivity.dll
WPFToolkit.Extended.dll
Settings.settings
SchoolSample.csproj.user
Settings.settings
SchoolModel.edmx
SchoolSample.Wcf.csproj.user
SchoolService.svc
SchoolSample.WCFService.csproj.user
configuration.svcinfo
configuration91.svcinfo
Reference.svcmap
SchoolService.disco
SchoolService.wsdl
SchoolSample.Model.accessor
SchoolSample.ViewModel.accessor
��SET NOCOUNT ON

GO



USE master

GO

if exists (select * from sysdatabases where name='SCHOOL')

        drop database SCHOOL

GO



DECLARE @device_directory NVARCHAR(520)

SELECT @device_directory = SUBSTRING(filename, 1, CHARINDEX(N'master.mdf', LOWER(filename)) - 1)

FROM master.dbo.sysaltfiles WHERE dbid = 1 AND fileid = 1



EXECUTE (N'CREATE DATABASE SCHOOL

  ON PRIMARY (NAME = N''SCHOOL'', FILENAME = N''' + @device_directory + N'SCHOOL.mdf'')

  LOG ON (NAME = N''SCHOOL_log'',  FILENAME = N''' + @device_directory + N'SCHOOL.ldf'')')

GO



exec sp_dboption 'SCHOOL','trunc. log on chkpt.','true'

exec sp_dboption 'SCHOOL','select into/bulkcopy','true'

GO



set quoted_identifier on

GO



/* Set DATEFORMAT so that the date strings are interpreted correctly regardless of

   the default DATEFORMAT on the server.

*/

SET DATEFORMAT mdy

GO

USE [SCHOOL]

GO

if  exists (select * from sys.objects where object_id = object_id(N'[dbo].[Enrollment]') and type in (N'U'))

    drop table [dbo].[Enrollment]

GO

if  exists (select * from sys.objects where object_id = object_id(N'[dbo].[Course]') and type in (N'U'))

    drop table [dbo].[Course]

GO

if  exists (select * from sys.objects where object_id = object_id(N'[dbo].[Person]') and type in (N'U'))

    drop table [dbo].[Person]

GO



USE [SCHOOL]

GO

/****** Object:  Table [dbo].[Person]  ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

SET ANSI_PADDING ON

GO

CREATE TABLE [dbo].[Person](

    [PersonId] [int] IDENTITY(1,1) NOT NULL,

    [Name] [varchar](50) NOT NULL,

    [EnrollmentDate] [datetime] NULL,

    [HireDate] [datetime] NULL,

    [Salary] [decimal](18, 2) NULL,

    [Role] [varchar](50) NOT NULL,

    [Version] [timestamp] NOT NULL,

 CONSTRAINT [PK_Person] PRIMARY KEY CLUSTERED 

(

    [PersonId] ASC

)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

) ON [PRIMARY]

GO

SET ANSI_PADDING OFF

GO

/****** Object:  Table [dbo].[Course]  ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

SET ANSI_PADDING ON

GO

CREATE TABLE [dbo].[Course](

    [CourseId] [int] IDENTITY(1,1) NOT NULL,

    [InstructorId] [int] NOT NULL,

    [Title] [varchar](50) NOT NULL,

    [Version] [timestamp] NOT NULL,

 CONSTRAINT [PK_Course] PRIMARY KEY CLUSTERED 

(

    [CourseId] ASC

)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

) ON [PRIMARY]

GO

SET ANSI_PADDING OFF

GO

/****** Object:  Table [dbo].[Enrollment]  ******/

SET ANSI_NULLS ON

GO

SET QUOTED_IDENTIFIER ON

GO

CREATE TABLE [dbo].[Enrollment](

    [EnrollmentId] [int] IDENTITY(1,1) NOT NULL,

    [StudentId] [int] NOT NULL,

    [CourseId] [int] NOT NULL,

    [Paid] [bit] NOT NULL,

    [Version] [timestamp] NOT NULL,

 CONSTRAINT [PK_Enrollment] PRIMARY KEY CLUSTERED 

(

    [EnrollmentId] ASC

)WITH (PAD_INDEX  = OFF, STATISTICS_NORECOMPUTE  = OFF, IGNORE_DUP_KEY = OFF, ALLOW_ROW_LOCKS  = ON, ALLOW_PAGE_LOCKS  = ON) ON [PRIMARY]

) ON [PRIMARY]

GO

/****** Object:  ForeignKey [FK_Course_Instructor]  ******/

ALTER TABLE [dbo].[Course]  WITH CHECK ADD  CONSTRAINT [FK_Course_Instructor] FOREIGN KEY([InstructorId])

REFERENCES [dbo].[Person] ([PersonId])

GO

ALTER TABLE [dbo].[Course] CHECK CONSTRAINT [FK_Course_Instructor]

GO

/****** Object:  ForeignKey [FK_Enrollment_Course]  ******/

ALTER TABLE [dbo].[Enrollment]  WITH CHECK ADD  CONSTRAINT [FK_Enrollment_Course] FOREIGN KEY([CourseId])

REFERENCES [dbo].[Course] ([CourseId])

GO

ALTER TABLE [dbo].[Enrollment] CHECK CONSTRAINT [FK_Enrollment_Course]

GO

/****** Object:  ForeignKey [FK_Enrollment_Student]  ******/

ALTER TABLE [dbo].[Enrollment]  WITH CHECK ADD  CONSTRAINT [FK_Enrollment_Student] FOREIGN KEY([StudentId])

REFERENCES [dbo].[Person] ([PersonId])

GO

ALTER TABLE [dbo].[Enrollment] CHECK CONSTRAINT [FK_Enrollment_Student]

GO

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)

About the Author

Weidong Shen
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

| Advertise | Privacy | Mobile
Web01 | 2.8.140721.1 | Last Updated 20 Feb 2012
Article Copyright 2011 by Weidong Shen
Everything else Copyright © CodeProject, 1999-2014
Terms of Service
Layout: fixed | fluid