DbMetadata.cs :  » Business-Application » Quartz-Enterprise-Scheduler » Quartz » Impl » AdoJobStore » Common » C# / CSharp Open Source

Home
C# / CSharp Open Source
1.2.6.4 mono .net core
2.2.6.4 mono core
3.Aspect Oriented Frameworks
4.Bloggers
5.Build Systems
6.Business Application
7.Charting Reporting Tools
8.Chat Servers
9.Code Coverage Tools
10.Content Management Systems CMS
11.CRM ERP
12.Database
13.Development
14.Email
15.Forum
16.Game
17.GIS
18.GUI
19.IDEs
20.Installers Generators
21.Inversion of Control Dependency Injection
22.Issue Tracking
23.Logging Tools
24.Message
25.Mobile
26.Network Clients
27.Network Servers
28.Office
29.PDF
30.Persistence Frameworks
31.Portals
32.Profilers
33.Project Management
34.RSS RDF
35.Rule Engines
36.Script
37.Search Engines
38.Sound Audio
39.Source Control
40.SQL Clients
41.Template Engines
42.Testing
43.UML
44.Web Frameworks
45.Web Service
46.Web Testing
47.Wiki Engines
48.Windows Presentation Foundation
49.Workflows
50.XML Parsers
C# / C Sharp
C# / C Sharp by API
C# / CSharp Tutorial
C# / CSharp Open Source » Business Application » Quartz Enterprise Scheduler 
Quartz Enterprise Scheduler » Quartz » Impl » AdoJobStore » Common » DbMetadata.cs
using System;
using System.Globalization;
using System.Reflection;

namespace Quartz.Impl.AdoJobStore.Common{
    /// <summary>
    /// Metadata information about specific ADO.NET driver library. Metadata is used to
    /// create correct types of object instances to interact with the underlying
    /// database.
    /// </summary>
    public class DbMetadata
    {
        private string productName;
        private string assemblyName;
        private Type connectionType;
        private Type commandType;
        private Type parameterType;
 
        private Type parameterDbType;
        private PropertyInfo parameterDbTypeProperty;
        private string parameterDbTypePropertyName;
        private PropertyInfo parameterIsNullableProperty;
        private string parameterNamePrefix;

        private Type exceptionType;
        private bool bindByName;
        private bool useParameterNamePrefixInParameterCollection;

        private Type commandBuilderType;
        private MethodInfo commandBuilderDeriveParametersMethod;
        private string dbBinaryTypeName;
        private Enum dbBinaryType;


        /// <summary>
        /// Initializes this instance. Parses information and initializes startup
        /// values.
        /// </summary>
        public void Init()
        {
            // parse value to db binary column type
            if (dbBinaryTypeName != null)
            {
                // not inited yet
                dbBinaryType = (Enum) Enum.Parse(parameterDbType, dbBinaryTypeName);
                parameterDbTypeProperty = parameterType.GetProperty(parameterDbTypePropertyName);
                if (parameterDbTypeProperty == null)
                {
                    throw new ArgumentException(string.Format(CultureInfo.InvariantCulture, "Couldn't parse parameter db type for database type '{0}'", productName));
                }
            }
        }

        /// <summary>Gets or sets the name of the assembly that holds the connection library.</summary>
        /// <value>The name of the assembly.</value>
        public virtual string AssemblyName
        {
            get { return assemblyName; }
            set { assemblyName = value; }
        }

        /// <summary>
        /// Gets or sets the name of the product.
        /// </summary>
        /// <value>The name of the product.</value>
        public virtual string ProductName
        {
            get { return productName; }
            set { productName = value; }
        }


        /// <summary>
        /// Gets or sets the type of the connection.
        /// </summary>
        /// <value>The type of the connection.</value>
        public virtual Type ConnectionType
        {
            get { return connectionType; }
            set { connectionType = value; }
        }

        /// <summary>
        /// Gets or sets the type of the command.
        /// </summary>
        /// <value>The type of the command.</value>
        public virtual Type CommandType
        {
            get { return commandType; }
            set { commandType = value; }
        }

        /// <summary>
        /// Gets or sets the type of the parameter.
        /// </summary>
        /// <value>The type of the parameter.</value>
        public virtual Type ParameterType
        {
            get { return parameterType; }
            set { parameterType = value; }
        }

        /// <summary>
        /// Gets the type of the command builder.
        /// </summary>
        /// <value>The type of the command builder.</value>
        public virtual Type CommandBuilderType
        {
            get { return commandBuilderType; }
            set { commandBuilderType = value;  }
        }

        /// <summary>Gets the command builder's derive parameters method.</summary>
        /// <value>The command builder derive parameters method.</value>
        public virtual MethodInfo CommandBuilderDeriveParametersMethod
        {
            get { return commandBuilderDeriveParametersMethod; }
            set { commandBuilderDeriveParametersMethod = value; }
        }

        /// <summary>
        /// Gets or sets the parameter name prefix.
        /// </summary>
        /// <value>The parameter name prefix.</value>
        public virtual string ParameterNamePrefix
        {
            get { return parameterNamePrefix; }
            set { parameterNamePrefix = value;  }
        }

        /// <summary>
        /// Gets or sets the type of the exception that is thrown when using driver
        /// library.
        /// </summary>
        /// <value>The type of the exception.</value>
        public virtual Type ExceptionType
        {
            get { return exceptionType; }
            set { exceptionType = value; }
        }

        /// <summary>
        /// Gets or sets a value indicating whether parameters are bind by name when using
        /// ADO.NET parameters.
        /// </summary>
        /// <value><c>true</c> if parameters are bind by name; otherwise, <c>false</c>.</value>
        public virtual bool BindByName
        {
            get { return bindByName; }
            set { bindByName = value; }
        }

        /// <summary>Gets or sets the type of the database parameters.</summary>
        /// <value>The type of the parameter db.</value>
        public virtual Type ParameterDbType
        {
            get { return parameterDbType; }
            set { parameterDbType = value; }
        }

        /// <summary>
        /// Gets the parameter db type property.
        /// </summary>
        /// <value>The parameter db type property.</value>
        public virtual PropertyInfo ParameterDbTypeProperty
        {
            get { return parameterDbTypeProperty; }
            set { parameterDbTypeProperty = value;  }
        }

        /// <summary>
        /// Gets the parameter is nullable property.
        /// </summary>
        /// <value>The parameter is nullable property.</value>
        public virtual PropertyInfo ParameterIsNullableProperty
        {
            get { return parameterIsNullableProperty; }
            set { parameterIsNullableProperty = value; }
        }

        /// <summary>
        /// Gets or sets the type of the db binary column. This is a string representation of
        /// Enum element because this information is database driver specific.
        /// </summary>
        /// <value>The type of the db binary.</value>
        public virtual string DbBinaryTypeName
        {
            set { dbBinaryTypeName = value; }
        }

        /// <summary>Gets the type of the db binary.</summary>
        /// <value>The type of the db binary.</value>
        public virtual Enum DbBinaryType
        {
            get { return dbBinaryType; }
        }


        /// <summary>
        /// Sets the name of the parameter db type property.
        /// </summary>
        /// <value>The name of the parameter db type property.</value>
        public virtual string ParameterDbTypePropertyName
        {
            set { parameterDbTypePropertyName = value; }
        }


        /// <summary>
        /// Gets or sets a value indicating whether [use parameter name prefix in parameter collection].
        /// </summary>
        /// <value>
        ///   <c>true</c> if [use parameter name prefix in parameter collection]; otherwise, <c>false</c>.
        /// </value>
        public virtual bool UseParameterNamePrefixInParameterCollection
        {
            get { return useParameterNamePrefixInParameterCollection; }
            set { useParameterNamePrefixInParameterCollection = value; }
        }

        /// <summary>
        /// Gets the name of the parameter which includes the parameter prefix for this
        /// database.
        /// </summary>
        /// <param name="parameterName">Name of the parameter.</param>
        public virtual string GetParameterName(string parameterName)
        {
            return parameterNamePrefix + parameterName; 
        }

    }
}
www.java2v.com | Contact Us
Copyright 2009 - 12 Demo Source and Support. All rights reserved.
All other trademarks are property of their respective owners.