ningshuxia
2023-02-06 1fc0b4ed96d4c4b1ff7142926239998de32b2ada
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
using System;
using System.Collections.Generic;
using System.Linq;
using System.Reflection;
using System.Runtime;
using System.Text;
using System.Threading.Tasks;
 
namespace IStation.DAL.Factory
{
    /// <summary>
    /// 数据访问类
    /// </summary>
    public class DataAccess
    { 
        private const string Remote_DllName = "";
        private const string Local_DllName = "IStation.DAL.LocalFile.Monitor";
 
 
        private const string Remote_NameSpace = "";
        private const string Local_NameSpace = "IStation.DAL.LocalFile";
 
        /// <summary>
        /// DLL名称
        /// </summary>
        private static string DllName
        {
            get
            {
                /*if (Settings.GlobalParas.IsRemoteMode)
                {
                    return Remote_DllName;
                }*/
                return Local_DllName;
            }
        }
 
        /// <summary>
        /// 命名控件
        /// </summary>
        private static string NameSpace
        {
            get
            {
                /*if (Settings.GlobalParas.IsRemoteMode)
                {
                    return Remote_NameSpace;
                }*/
                return Local_NameSpace;
            }
        }
 
 
        /// <summary>
        /// 创建
        /// </summary> 
        public static I Create<I>()
        {
            if (string.IsNullOrEmpty(DllName))
            {
                LogHelper.Error($"DAL工厂创建IDAL接口对象失败,请检查相关配置参数!");
                return default;
            }
 
            if (string.IsNullOrEmpty(NameSpace))
            {
                LogHelper.Error($"DAL工厂创建IDAL接口对象失败,请检查相关配置参数!");
                return default;
            }
 
            var obj = DataAccessBase.CreateDAL<I>(DllName, NameSpace);
            return (I)obj;
        }
 
    }
}