• 大小: 23KB
    文件类型: .rar
    金币: 2
    下载: 1 次
    发布日期: 2021-06-12
  • 语言: 数据库
  • 标签: Dapper  

资源简介

基于Dapper 的扩展,改进了 DapperExtensions的部分代码,添加了oracle 的支持,修复了部分bug

资源截图

代码片段和文件信息

using System;
using System.Collections.Generic;
using System.Data;
using System.Reflection;
using DapperExtensions.Mapper;
using DapperExtensions.Sql;
using HY.DataAccess;

namespace DapperExtensions
{
    public static class DapperExtensions
    {
        private readonly static object _lock = new object();

        private static Func _instanceFactory;
        private static IDapperImplementor _instance;
        private static DictionaryseType IDapperImplementor> _instanceList = new DictionaryseType IDapperImplementor>();
        private static IDapperExtensionsConfiguration _configuration;


        /// 
        /// Gets or sets the default class mapper to use when generating class maps. If not specified AutoClassMapper is used.
        /// DapperExtensions.Configure(Type IList ISqlDialect) can be used instead to set all values at once
        /// 

        public static Type DefaultMapper
        {
            get
            {
                return _configuration.DefaultMapper;
            }
            set
            {
                Configure(value _configuration.MappingAssemblies _configuration.Dialect);
            }
        }

        /// 
        /// Gets or sets the type of sql to be generated.
        /// DapperExtensions.Configure(Type IList ISqlDialect) can be used instead to set all values at once
        /// 

        public static ISqlDialect SqlDialect
        {
            get
            {
                return _configuration.Dialect;
            }

            set
            {
                Configure(_configuration.DefaultMapper _configuration.MappingAssemblies value);
            }
        }

        /// 
        /// Get or sets the Dapper Extensions Implementation Factory.
        /// 

        public static Func InstanceFactory
        {
            get
            {
                if (_instanceFactory == null)
                {
                    _instanceFactory = config => new DapperImplementor(new SqlGeneratorImpl(config));
                }
                return _instanceFactory;
            }
            //set
            //{
            //    _instanceFactory = value;
            //    Configure(_configuration.DefaultMapper _configuration.MappingAssemblies _configuration.Dialect);
            //}
        }


        /// 
        /// Gets the Dapper Extensions Implementation
        /// 

        private static IDapperImplementor Instance(DatabaseType databaseType = DatabaseType.SqlServer)
        {
            if (!_instanceList.ContainsKey(databaseType))
            {
                lock (_instanceList)
                {
                    if (!_instanceList.ContainsKey(databaseType))
             

 属性            大小     日期    时间   名称
----------- ---------  ---------- -----  ----

    I.A....     13280  2015-06-09 09:16  DapperExtensions\DapperExtensions.cs

    I.A....      3911  2015-06-09 09:16  DapperExtensions\DapperExtensionsConfiguration.cs

    I.A....     21756  2015-07-17 17:00  DapperExtensions\DapperImplementor.cs

    I.A....     10283  2015-06-09 09:16  DapperExtensions\Database.cs

    I.A....      1294  2015-06-09 09:16  DapperExtensions\GetMultiplePredicate.cs

    I.A....       985  2015-06-09 09:16  DapperExtensions\GetMultipleResult.cs

    I.A....       498  2015-03-03 09:19  DapperExtensions\Mapper\AutoClassMapper.cs

    I.A....      5390  2015-03-03 09:19  DapperExtensions\Mapper\ClassMapper.cs

    I.A....      4061  2015-03-03 09:19  DapperExtensions\Mapper\PluralizedAutoClassMapper.cs

    I.A....      4522  2015-08-18 17:22  DapperExtensions\Mapper\PropertyMap.cs

    I.A....     14927  2015-05-18 09:30  DapperExtensions\Predicates.cs

    I.A....      4051  2015-06-12 09:23  DapperExtensions\Reflectionhelper.cs

    I.A....      1386  2015-06-09 09:16  DapperExtensions\Sql\MySqlDialect.cs

    I.A....      2201  2015-06-09 09:16  DapperExtensions\Sql\OracleDialect.cs

    I.A....      1318  2015-06-09 09:16  DapperExtensions\Sql\PostgreSqlDialect.cs

    I.A....      2062  2015-06-09 09:16  DapperExtensions\Sql\SqlCeDialect.cs

    I.A....      4351  2015-03-03 09:19  DapperExtensions\Sql\SqlDialectbase.cs

    I.A....     11535  2015-05-20 09:16  DapperExtensions\Sql\SqlGenerator.cs

    I.A....      1760  2015-03-03 09:19  DapperExtensions\Sql\SqliteDialect.cs

    I.A....      5217  2015-07-17 16:56  DapperExtensions\Sql\SqlServerDialect.cs

     目录          0  2015-08-18 17:22  DapperExtensions\Mapper

     目录          0  2015-07-17 16:56  DapperExtensions\Sql

     目录          0  2015-07-17 17:00  DapperExtensions

----------- ---------  ---------- -----  ----

               114788                    23


评论

共有 条评论

相关资源