The sample custom medical storage data access layer is called My.Medical.Storage.DataAccessLayer. It is included in the LEAD installation as a sample project. It contains all of the classes in the two tables.

Open the project file in Visual Studio, and you will see the files in the project:

The following table describes the contents of each file

Folder

FileName

Contents

Configuration

Classes to extract DICOM data from a System.Data.DataRow

MyPatientInfo.cs

class MyPatientInfo : IPatientInfo

MyStudyInfo.cs

class MyStudyInfo : IStudyInfo

MySeriesInfo.cs

class MySeriesInfo : ISeriesInfo

MyInstanceInfo.cs

class MyInstanceInfo : IInstanceInfo

DataAccessLogic\BusinessEntity

A strongly typed class that represents an in-memory representation of your custom database

The methods override the default behavior of the StorageSqlDbDataAccessAgent.

Query Commands

protected override void PreparePatientsQueryCommand

protected override void PrepareStudiesQueryCommand

protected override void PrepareSeriesQueryCommand

protected override void PrepareInstanceQueryCommand

Creates a command to query the database based on a level (i.e PrepareSeriesQueryCommand creates a command for a series level database query)

protected override void PrepareInstancePageQueryCommand

Prepares an Instance level command when using pagination. Pagination returns results in one or more pages of data, where the user specifies the page size. The pagination feature is not implemented in this sample data access agent.

Count Commands

protected override void PreparePatientsQueryCountCommand

protected override void PrepareStudiesQueryCountCommand

protected override void PrepareSeriesQueryCountCommand

protected override void PrepareInstanceQueryCountCommand

Creates a command that returns a count of rows matching the search criteria specified in the matchingParamsCollection

Delete Commands

protected override void PrepareDeletePatientsCommand

protected override void PrepareDeleteStudiesCommand

protected override void PrepareDeleteSeriesCommand

protected override void PrepareDeleteInstanceCommand

Creates a command to delete rows of a System.Data.DataTable based on the search criteria specified in the matchingParamsCollection

protected override void PrepareDeletePatientsNoChildStudiesCommand

protected override void PrepareDeleteStudiesNoChildSeriesCommand

protected override void PrepareDeleteSeriesNoChildInstancesCommand

Creates a command to delete rows from a table that has no corresponding rows in a child table. For example, the PrepareDeletePatientsNoChildStudiesCommand command would be invoked if a MyPatient table entry had no corresponding entry in the MyStudy table.

public override int DeletePatient

public override int DeleteStudy

public override int DeleteSeries

public override int DeleteInstance

High-level commands that deletes rows from a database table based on the search criteria specified in the matchingParamsCollection

Uses the PrepareDeleteXxxxCommand() overrides

These commands also delete the corresponding rows in the tables above it in the hierarchy

For example, DeleteStudy will delete one or more rows from the MyStudy table. If the corresponding MyPatientTable patient rows contain no more studies, then these are also deleted.

Exists Commands

protected override void PrepareIsPatientExistsCommand

protected override void PrepareIsStudiesExistsCommand

protected override void PrepareIsSeriesExistsCommand

protected override void PrepareIsInstanceExistsCommand

Creates a command to test for existence based on unique ID (PatientID, StudyInstanceUID, SeriesInstanceUID, or SOPInstanceUID)

Creates a DataSet representing the tables of your database. This is actually a strongly typed, but it is returned as the base class DataSet. The default implementation returns CompositeInstanceDataSet. For the tutorial, you will return the strongly typed MyDataSet.

MyPatient

MyStudy

MySeries

MyInstance

public virtual void UpdateCompositeInstance

Updates the necessary table entries (MyPatient, MyStudy, MySeries, MyInstance) in the database, based on the input parameter myDataSet.

myDataSet is a DataSet that contains all the necessary additions, updates, and deletions that need to be applied

If there is an exception during the process, all updates are backed out.