• Articles
  • Api Documentation

    Show / Hide Table of Contents
    • DataBaseAccess
      • DataBaseAccess
        • DataAccessService
        • IDataAccessService
        • QueryResult
      • DataBaseAccess.Extensions
        • DataReaderExtension
    • EmailLib
      • EmailLib
        • EmailService
        • SmtpServerConfig
    • WebApplication
      • WebApplication
        • _Default
        • About
        • Account
        • Account.ActiveNav
        • AppConfig
        • AppConfig.Json
        • AppConfig.SmtpServer
        • AppConfig.WebSite
        • AppConfig.Xml
        • BundleConfig
        • CambiarPassword
        • Confirmar
        • Contact
        • EmailSent
        • Global
        • Inicio
        • RedirectPage
        • Registro
        • RouteConfig
        • ScriptResource
        • Site_Mobile
        • SiteMaster
        • ViewSwitcher
        • WebAlertNotification
      • WebApplication.ComprobarMatriculaService
        • comprobarCompletedEventArgs
        • comprobarCompletedEventHandler
        • Matriculas
      • WebApplication.CustomControls
        • ConnectedUsers
        • WebNotification
      • WebApplication.Framework
        • AlertLevel
        • AppSecurity
        • ConnectedUsersTrack
        • NotificationData
        • ParametizedUrl
        • Query
        • Query.GenericTasks
        • UserRole
        • UserType
      • WebApplication.Framework.Extensions
        • AttributeCollectionExtension
        • DictionaryExtension
      • WebApplication.TimeMeanWebService
        • GetAllSubjectsMeansCompletedEventArgs
        • GetAllSubjectsMeansCompletedEventHandler
        • GetSubjectMeansCompletedEventArgs
        • GetSubjectMeansCompletedEventHandler
        • SubjectsMeansService
      • WebApplication.UserPages
        • Coordinador
        • ExportarTareas
        • ImportarTareasDataSet
        • ImportarTareasXmlDocument
        • InsertarTarea
        • InstanciarTarea
        • Student
        • StudentHome
        • StudentMenu
        • TareasAlumno
        • TareasProfesor
        • Teacher
        • TeacherHome
        • TeacherMenu
      • WebApplication.Utils
        • JsonFile
        • UrlUtils

    Class DataAccessService

    Inheritance
    System.Object
    DataAccessService
    Implements
    IDataAccessService
    Inherited Members
    System.Object.ToString()
    System.Object.Equals(System.Object)
    System.Object.Equals(System.Object, System.Object)
    System.Object.ReferenceEquals(System.Object, System.Object)
    System.Object.GetHashCode()
    System.Object.GetType()
    System.Object.MemberwiseClone()
    Namespace: DataBaseAccess
    Assembly: DataBaseAccess.dll
    Syntax
    public class DataAccessService : IDataAccessService

    Constructors

    | Improve this Doc View Source

    DataAccessService(String)

    Declaration
    public DataAccessService(string connectionString)
    Parameters
    Type Name Description
    System.String connectionString

    Properties

    | Improve this Doc View Source

    ConnectionString

    Property containing the connection string to the database.

    Declaration
    public string ConnectionString { get; }
    Property Value
    Type Description
    System.String

    Methods

    | Improve this Doc View Source

    CreateDataAdapter(String, Dictionary<String, Object>, CommandType)

    Declaration
    public SqlDataAdapter CreateDataAdapter(string query, Dictionary<string, object> parameters = null, CommandType commandType = CommandType.Text)
    Parameters
    Type Name Description
    System.String query
    System.Collections.Generic.Dictionary<System.String, System.Object> parameters
    System.Data.CommandType commandType
    Returns
    Type Description
    System.Data.SqlClient.SqlDataAdapter
    | Improve this Doc View Source

    CreateQueryDataTable(String, Dictionary<String, Object>, CommandType)

    Creates and returns a System.Data.DataTable with the sql query string passed as parameter.

    Declaration
    public DataTable CreateQueryDataTable(string query, Dictionary<string, object> parameters = null, CommandType commandType = CommandType.Text)
    Parameters
    Type Name Description
    System.String query

    The sql query to execute

    System.Collections.Generic.Dictionary<System.String, System.Object> parameters

    The query aditional parameters

    System.Data.CommandType commandType

    Indicates how the query string will be interpreted. The default is System.Data.CommandType.Text

    Returns
    Type Description
    System.Data.DataTable

    The created System.Data.DataTable

    | Improve this Doc View Source

    NonQuery(String, Dictionary<String, Object>, CommandType)

    Executes the passed sql query in the database and returns the number of rows affected. For UPDATE, INSERT, and DELETE statements, the return value is the number of rows affected by the command. When a trigger exists on a table being inserted or updated, the return value includes the number of rows affected by both the insert or update operation and the number of rows affected by the trigger or triggers. For all other types of statements and rollbacks the return value is -1.

    Declaration
    public int NonQuery(string query, Dictionary<string, object> parameters = null, CommandType commandType = CommandType.Text)
    Parameters
    Type Name Description
    System.String query

    The sql query to execute

    System.Collections.Generic.Dictionary<System.String, System.Object> parameters

    The query aditional parameters

    System.Data.CommandType commandType

    Indicates how the query string will be interpreted. The default is System.Data.CommandType.Text

    Returns
    Type Description
    System.Int32

    The number of rows affected

    | Improve this Doc View Source

    Query(String, Dictionary<String, Object>, CommandType)

    Executes the passed sql query in the database and returns a System.Collections.Generic.List<T> of elements of type System.Collections.Generic.Dictionary<TKey, TValue>. Each element in the list represents a row and each dictionary element represents a column. The column value can be accesed by its same.

    Declaration
    public QueryResult Query(string query, Dictionary<string, object> parameters = null, CommandType commandType = CommandType.Text)
    Parameters
    Type Name Description
    System.String query

    The sql query to execute

    System.Collections.Generic.Dictionary<System.String, System.Object> parameters

    The query aditional parameters

    System.Data.CommandType commandType

    Indicates how the query string will be interpreted. The default is System.Data.CommandType.Text

    Returns
    Type Description
    QueryResult

    A collection of rows returned by the query

    | Improve this Doc View Source

    Scalar<T>(String, Dictionary<String, Object>, CommandType)

    Retrieve a single value from a database. It returns the first column of the first row in the result set returned by the query, the additional columns or rows are ignored.

    Declaration
    public T Scalar<T>(string query, Dictionary<string, object> parameters = null, CommandType commandType = CommandType.Text)
    Parameters
    Type Name Description
    System.String query

    The sql query to execute

    System.Collections.Generic.Dictionary<System.String, System.Object> parameters

    The query aditional parameters

    System.Data.CommandType commandType

    Indicates how the query string will be interpreted. The default is System.Data.CommandType.Text

    Returns
    Type Description
    T

    The first column of the first row in the result set, or a null reference if the result set is empty.

    Type Parameters
    Name Description
    T

    The expected scalar query type

    Implements

    IDataAccessService
    • Improve this Doc
    • View Source
    Back to top Copyright © 2019 Ferran Tudela