C# Class SIP_Agent.Model.Crud

Abstract class for all CRUD models
显示文件 Open project: anroots/SIP-Agent

Protected Properties

Property Type Description
CurrentConnection DatabaseDataContext

Private Properties

Property Type Description

Public Methods

Method Description
Crud ( ) : System

Default constructor - create a new DatabaseDataContext

FindAll ( int Limit ) : IQueryable

Find all non-deleted rows

Load ( int Id ) : bool

Load the model with the specified ID

Loaded ( ) : bool

Check if the model is loaded

New ( ) : int

Create a new row

Save ( ) : int

Save the currently loaded model

Unload ( ) : void

Unload the model

Protected Methods

Method Description
ResetConnection ( ) : void

Reset the DB connection

Method Details

Crud() public method

Default constructor - create a new DatabaseDataContext
public Crud ( ) : System
return System

FindAll() public method

Find all non-deleted rows
public FindAll ( int Limit ) : IQueryable
Limit int Max number of rows to return
return IQueryable

Load() public method

Load the model with the specified ID
public Load ( int Id ) : bool
Id int The ID of the row in the database
return bool

Loaded() public method

Check if the model is loaded
public Loaded ( ) : bool
return bool

New() public method

Create a new row
public New ( ) : int
return int

ResetConnection() protected method

Reset the DB connection
protected ResetConnection ( ) : void
return void

Save() public method

Save the currently loaded model
public Save ( ) : int
return int

Unload() public method

Unload the model
public Unload ( ) : void
return void

Property Details

CurrentConnection protected_oe property

Stores the current database connection. In order for SubmitChanges to work the connection must stay open. The connection can be released by the Unload method.
protected DatabaseDataContext CurrentConnection
return DatabaseDataContext