프로젝트

일반

사용자정보

개정판 0fce3dac

ID0fce3dac08bd4a20474fd3f8f295f5752b10193b
상위 f6c94121
하위 d952e1d5

김태성이(가) 약 2년 전에 추가함

issue #0000 dapper postgresql 수정

Change-Id: I9b298c1ca79b50f6eda83cb2bb3d412c5cc76db1

차이점 보기:

ConvertService/ServiceBase/Markus.Service.DataBase.Dapper/Markus.Service.DataBase.Dapper.csproj
50 50
  <PropertyGroup Condition="'$(Configuration)|$(Platform)' == 'Debug|x64'">
51 51
    <DebugSymbols>true</DebugSymbols>
52 52
    <OutputPath>bin\x64\Debug\</OutputPath>
53
    <DefineConstants>DEBUG;TRACE</DefineConstants>
53
    <DefineConstants>TRACE;DEBUG;IDE0038</DefineConstants>
54 54
    <DebugType>full</DebugType>
55 55
    <PlatformTarget>AnyCPU</PlatformTarget>
56 56
    <LangVersion>7.3</LangVersion>
......
82 82
  </ItemGroup>
83 83
  <ItemGroup>
84 84
    <Compile Include="DBMSType.cs" />
85
    <Compile Include="dbTypeConvert.cs" />
85 86
    <Compile Include="Entities\ConvertDoc.cs" />
86 87
    <Compile Include="Entities\DOCINFO.cs" />
87 88
    <Compile Include="Entities\DOCPAGE.cs" />
......
90 91
    <Compile Include="Entities\SERVICEPROPERTIES.cs" />
91 92
    <Compile Include="Extensions.cs" />
92 93
    <Compile Include="Handler\ParameterHandler.cs" />
94
    <Compile Include="MixParameters.cs" />
93 95
    <Compile Include="PropertiesTypeDefine.cs" />
94 96
    <Compile Include="Properties\AssemblyInfo.cs" />
95 97
    <Compile Include="RepositoriesInterfaces\IConvertDocRepository.cs" />
......
117 119
    <PackageReference Include="Markus.Message">
118 120
      <Version>2.0.0</Version>
119 121
    </PackageReference>
120
    <PackageReference Include="Microsoft.Bcl.AsyncInterfaces">
121
      <Version>1.1.0</Version>
122
    </PackageReference>
123 122
    <PackageReference Include="Npgsql">
124
      <Version>4.1.13</Version>
125
    </PackageReference>
126
    <PackageReference Include="System.Memory">
127
      <Version>4.5.3</Version>
128
    </PackageReference>
129
    <PackageReference Include="System.Runtime.CompilerServices.Unsafe">
130
      <Version>4.6.0</Version>
131
    </PackageReference>
132
    <PackageReference Include="System.Text.Json">
133
      <Version>4.6.0</Version>
134
    </PackageReference>
135
    <PackageReference Include="System.Threading.Tasks.Extensions">
136
      <Version>4.5.3</Version>
137
    </PackageReference>
138
    <PackageReference Include="System.ValueTuple">
139
      <Version>4.5.0</Version>
123
      <Version>4.1.12</Version>
140 124
    </PackageReference>
141 125
  </ItemGroup>
142 126
  <ItemGroup>
ConvertService/ServiceBase/Markus.Service.DataBase.Dapper/Repositories/BaseRepository.cs
30 30
                    break;
31 31
                case DBMSType.POSTGRESQL:
32 32
                    Connection = new Npgsql.NpgsqlConnection(dbConnectionString.ToString());
33
                    
33 34
                    break;
34 35
                default:
35 36
                    break;
36 37
            }
37 38
            
38
            SqlMapper.AddTypeHandler(new Handler.ParameterHandler<object>(DBMS));
39

  
40 39
            Connection.Open();
41 40
        }
42 41

  
......
62 61
                Connection.Open();
63 62
            }
64 63

  
65
            var parameter = new DynamicParameters();
66
            parameters.ForEach(x => parameter.Add(x.Name, x.Value, x.DbType));
64
            var parameter = new MixParameters(DBMS);
65
            parameters.ForEach(x => parameter.Add(x.Name, x.Value, dbType: x.DbType));
67 66

  
68 67
            return await Connection.QueryAsync<T>(SQL, parameter);
69 68
        }
70 69

  
71
        public async Task<IEnumerable<T>> QueryAsync<T>(string SQL, DynamicParameters parameters)
70
        public async Task<IEnumerable<T>> QueryAsync<T>(string SQL, SqlMapper.IDynamicParameters parameters, CommandType commandType = CommandType.TableDirect)
72 71
        {
73 72
            if (Connection.State != System.Data.ConnectionState.Open)
74 73
            {
75 74
                Connection.Open();
76 75
            }
77 76

  
78
            return await Connection.QueryAsync<T>(SQL, parameters);
77
            return await Connection.QueryAsync<T>(SQL, parameters,commandType: commandType);
79 78
        }
80 79

  
81 80
        public async Task<T> GetSingleAsync<T>(string SQL, List<sqlParameter> parameters)
......
85 84
                Connection.Open();
86 85
            }
87 86

  
88
            var parameter = new DynamicParameters();
89
            parameters.ForEach(x => parameter.Add(x.Name, x.Value, x.DbType));
87
            var parameter = new MixParameters(DBMS);
88
            parameters.ForEach(x => parameter.Add(x.Name, x.Value, dbType: x.DbType));
90 89

  
91 90
            return await Connection.QuerySingleAsync<T>(SQL, parameter);
92 91
        }
......
102 101
            return await Connection.QueryAsync<T>(SQL, parameters, commandType: commandType);
103 102
        }
104 103

  
105
        public async Task<T> GetFirstAsync<T>(string SQL,DynamicParameters parameters)
104
        public async Task<T> GetFirstAsync<T>(string SQL,SqlMapper.IDynamicParameters parameters)
106 105
        {
107 106
            if (Connection.State != System.Data.ConnectionState.Open)
108 107
            {
......
119 118
                Connection.Open();
120 119
            }
121 120

  
122
            var parameter = new DynamicParameters();
123
            parameters.ForEach(x => parameter.Add(x.Name, x.Value, x.DbType));
121
            var parameter = new MixParameters(DBMS);
122
            parameters.ForEach(x => parameter.Add(x.Name, x.Value, dbType: x.DbType));
124 123

  
125 124
            return await Connection.ExecuteAsync(SQL, parameters, commandType: CommandType.StoredProcedure);
126 125
        }
127 126

  
128
        public async Task<int> ExecuteAsync(string SQL, DynamicParameters parameters,IDbTransaction transaction, CommandType commandType)
127
        public async Task<int> ExecuteAsync(string SQL, SqlMapper.IDynamicParameters parameters,IDbTransaction transaction, CommandType commandType)
129 128
        {
130 129
            if (Connection.State != System.Data.ConnectionState.Open)
131 130
            {
132 131
                Connection.Open();
133 132
            }
134 133

  
135
            return await Connection.ExecuteAsync(SQL, parameters, transaction, commandType: CommandType.StoredProcedure);
134
            return await Connection.ExecuteAsync(SQL, parameters, transaction, commandType: commandType);
136 135
        }
137 136
    }
138 137
}
ConvertService/ServiceBase/Markus.Service.DataBase.Dapper/Repositories/ConvertDocRepository.cs
1
using Dapper;
2
using Markus.Service.DataBase.Entities;
3
using Markus.Service.DataBase.RepositoriesInterfaces;
1 4
using System;
2
using System.Threading.Tasks;
3 5
using System.Collections.Generic;
4 6
using System.Data;
5 7
using System.Linq;
6
using System.Data.SqlClient;
7
using Dapper;
8
using Markus.Service.DataBase.Entities;
9
using Markus.Service.DataBase.RepositoriesInterfaces;
10
using Markus;
8
using System.Threading.Tasks;
11 9

  
12 10
namespace Markus.Service.DataBase.Repositories
13 11
{
......
21 19
        {
22 20
            List<ConvertDoc> list = null;
23 21

  
24
            var parameters = new DynamicParameters();
25
            parameters.Add("@P_TakeCount", TakeCount, DbType.Int32);
22
            var parameters = new MixParameters(DBMS);
23
            parameters.Add("takecount", TakeCount);
26 24

  
27 25
            var result = await base.QueryAsync<ConvertDoc>("CONVERT_SELECT_WAITorERROR", parameters, commandType: CommandType.StoredProcedure);
28 26
            if (result == null) return null;
......
37 35

  
38 36
            List<string> whereSQL = new List<string>();
39 37

  
40
            var parameters = new DynamicParameters();
38
            var parameters = new MixParameters(DBMS);
41 39

  
42 40
            if (ProjectNo != null)
43 41
            {
44
                whereSQL.Add("PROJECT_NO = @PROJECT_NO");
45
                parameters.Add("@PROJECT_NO", ProjectNo, System.Data.DbType.String);
42
                whereSQL.Add("PROJECT_NO = PROJECT_NO");
43
                parameters.Add("PROJECT_NO", ProjectNo);
46 44
            }
47 45

  
48 46
            if (Status > -1)
49 47
            {
50
                whereSQL.Add("STATUS = @STATUS");
51
                parameters.Add("@STATUS", Status, System.Data.DbType.Int32);
48
                whereSQL.Add("STATUS = STATUS");
49
                parameters.Add("STATUS", Status);
52 50
            }
53 51

  
54 52
            if (ConvertID != null)
55 53
            {
56
                whereSQL.Add("ID = @ID");
57
                parameters.Add("@ID", ConvertID, System.Data.DbType.String);
54
                whereSQL.Add("ID = ID");
55
                parameters.Add("ID", ConvertID);
58 56
            }
59 57

  
60 58
            if (DocumentID != null)
61 59
            {
62
                whereSQL.Add("DOCUMENT_ID = @DOCUMENT_ID");
63
                parameters.Add("@DOCUMENT_ID", DocumentID, System.Data.DbType.String);
60
                whereSQL.Add("DOCUMENT_ID = DOCUMENT_ID");
61
                parameters.Add("DOCUMENT_ID", DocumentID);
64 62
            }
65 63

  
66 64
            SQL = SQL + string.Join(" AND ", whereSQL.ToArray());
......
90 88

  
91 89
        public async Task<IEnumerable<ConvertDoc>> GetConvertDocAsync(int status)
92 90
        {
93
            string SQL = "SELECT * FROM CONVERTER_DOC WHERE STATUS = @STATUS";
91
            string SQL = "SELECT * FROM CONVERTER_DOC WHERE STATUS = STATUS";
94 92

  
95
            var parameters = new DynamicParameters();
96
            parameters.Add("@STATUS", status, System.Data.DbType.String);
93
            var parameters = new MixParameters(DBMS);
94
            parameters.Add("STATUS", status);
97 95

  
98 96
            var convertItems = await base.QueryAsync<Markus.Service.DataBase.Entities.ConvertDoc>(SQL, parameters);
99 97

  
......
131 129
        {
132 130
            List<ConvertDoc> list = null;
133 131

  
134
            var parameters = new DynamicParameters();
135
            parameters.Add("@P_TakeCount", TakeCount, DbType.Int32);
132
            var parameters = new MixParameters(DBMS);
133
            parameters.Add("takecount", TakeCount);
136 134

  
137 135
            var result = await base.QueryAsync<ConvertDoc>("CONVERT_SELECT_CONVERTINGITEMS", parameters, commandType: CommandType.StoredProcedure);
138 136

  
......
148 146
            int result = -1;
149 147
            var tran = BeginTransaction();
150 148

  
151
            var parameters = new DynamicParameters();
152
            parameters.Add("@P_ConverterDocID", convertID, DbType.String);
153
            parameters.Add("@P_ReConvert", ReConvert, DbType.Int32);
154
            parameters.Add("@return", ReConvert, DbType.Int32, ParameterDirection.ReturnValue);
149
            var parameters = new MixParameters(DBMS);
150
            parameters.Add("converterdocid", convertID);
151
            parameters.Add("reconvert", ReConvert);
152
            parameters.Add("return", ReConvert,direction:ParameterDirection.ReturnValue);
155 153

  
156 154
            await base.ExecuteAsync("CONVERT_UPDATE_CLEANUP_ITEM", parameters, tran, commandType: CommandType.StoredProcedure);
157

  
158
            result = parameters.Get<int>("@return");
155
           
159 156
            tran.Commit();
160

  
157
            
158
            result = parameters.Get<int>("return");
159
        
161 160
            return result;
162 161
        }
163 162

  
......
166 165
        {
167 166
            string result = null;
168 167
            try
169
            {   
168
            {
169
                var tran = BeginTransaction();
170

  
171
                var parameters = new MixParameters(DBMS);
172
                parameters.Add("project_no", value: PROJECT_NO);
173
                parameters.Add("document_url",value: DOCUMENT_URL);
174
                parameters.Add("document_id",value: DOCUMENT_ID);
175
                parameters.Add("newid", direction: ParameterDirection.Output);
176
               
177
                await base.ExecuteAsync("convert_insert_convertdoc", parameters, transaction: tran, commandType: CommandType.StoredProcedure);
178
                
179
                tran.Commit();
180

  
181
                result = parameters.Get<string>("newid");
182
            }
183
            catch (Exception ex)
184
            {
185

  
186
                throw ex;
187
            }
188
            return result;
189
        }
190

  
191
        public async Task<string> Create(string PROJECT_NO, string DOCUMENT_URL, string DOCUMENT_ID)
192
        {
193
            string result = null;
194
            try
195
            {
170 196
                var tran = BeginTransaction();
171
             
172
                var parameters = new DynamicParameters();
173
                parameters.Add("@PROJECT_NO", PROJECT_NO, DbType.String);
174
                parameters.Add("@DOCUMENT_URL", DOCUMENT_URL, DbType.String);
175
                parameters.Add("@DOCUMENT_ID", DOCUMENT_ID, DbType.String);
176
                parameters.Add("@NewID", dbType: DbType.String, direction: ParameterDirection.Output, size: 50);
177
    
178
                await base.ExecuteAsync("CONVERT_INSERT_CONVERTDOC", parameters, transaction: tran, commandType: CommandType.StoredProcedure);
179

  
180
                result = parameters.Get<string>("@NewID");
197

  
198

  
199
                var parameters = new MixParameters(DBMS);
200
                parameters.Add("project_no", value: PROJECT_NO);
201
                parameters.Add("document_url", value: DOCUMENT_URL);
202
                parameters.Add("document_id", value: DOCUMENT_ID);
203
                parameters.Add("newid", direction: ParameterDirection.Output);
204

  
205
                await base.ExecuteAsync("convert_insert_convertdoc", parameters, transaction: tran, commandType: CommandType.StoredProcedure);
206
              
181 207
                tran.Commit();
208

  
209
                result = parameters.Get<string>("newid");
210
           
182 211
            }
183
            catch (Exception)
212
            catch (Exception ex)
184 213
            {
185 214

  
186
                throw;
215
                throw ex;
187 216
            }
188 217
            return result;
189 218
        }
......
191 220
        public async Task<int> UpdateStatusAsync(string ServiceID, string ConvertDocID, int status, int totalPage, int currentPage, string exception)
192 221
        {
193 222
            int result = 0;
194

  
195 223
            var tran = BeginTransaction();
196 224

  
197
            var parameters = new DynamicParameters();
198
            parameters.Add("@SERVICE_ID", ServiceID, DbType.String);
199
            parameters.Add("@ID", ConvertDocID, DbType.String);
200
            parameters.Add("@STATUS", status, DbType.String);
201
            parameters.Add("@TOTAL_PAGE", totalPage, DbType.Int32);
202
            parameters.Add("@CURRENT_PAGE", currentPage, DbType.Int32);
203
            parameters.Add("@EXCEPTION", exception, DbType.String);
204

  
225
            var parameters = new MixParameters(DBMS);
226
            parameters.Add("SERVICE_ID", ServiceID);
227
            parameters.Add("ID", ConvertDocID);
228
            parameters.Add("STATUS", status);
229
            parameters.Add("TOTAL_PAGE", totalPage);
230
            parameters.Add("CURRENT_PAGE", currentPage);
231
            parameters.Add("EXCEPTION", exception);
232
  
205 233
            result = await base.ExecuteAsync("CONVERT_UPDATE_STATUS", parameters, transaction: tran, commandType: CommandType.StoredProcedure);
206 234
            tran.Commit();
235

  
207 236
            return result;
208 237
        }
209 238

  
210 239
    }
240

  
211 241
}
212 242

  
ConvertService/ServiceBase/Markus.Service.DataBase.Dapper/Repositories/DOCINFORepository.cs
21 21

  
22 22
        }
23 23

  
24
        /// <summary>
25
        /// test ??? transaction Commit ???? parameter.get?? ??? commit?? ???.
26
        /// </summary>
27
        /// <param name="convertDocID"></param>
28
        /// <param name="PageCount"></param>
29
        /// <returns></returns>
24 30
        public async Task<string> CreateAsync(string convertDocID, int PageCount)
25 31
        {
26 32
            string result = "";
27 33
            var tran = BeginTransaction();
28 34

  
29
            var parameters = new DynamicParameters();
30
            parameters.Add("@CONVERT_ID", convertDocID, DbType.String);
31
            parameters.Add("@PAGE_COUNT", PageCount, DbType.Int32);
32
            parameters.Add("@NewID", dbType: DbType.String, direction: ParameterDirection.Output, size: 50);
33
            parameters.Add("@ErrorCode", dbType: DbType.Int32, direction: ParameterDirection.Output);
34
            parameters.Add("@Error", dbType: DbType.String, direction: ParameterDirection.Output, size: 500);
35
            var parameters = new MixParameters(DBMS);
36
            parameters.Add("CONVERT_ID", convertDocID, dbType: DbType.String);
37
            parameters.Add("PAGE_COUNT", PageCount, dbType: DbType.Int32);
38
            parameters.Add("NewID", dbType: DbType.String, direction: ParameterDirection.Output, size: 50);
39
            parameters.Add("ErrorCode", dbType: DbType.Int32, direction: ParameterDirection.Output);
40
            parameters.Add("Error", dbType: DbType.String, direction: ParameterDirection.Output, size: 500);
35 41

  
36 42
            await base.ExecuteAsync("CONVERT_INSERT_DOCINFO", parameters, tran, commandType: CommandType.StoredProcedure);
37 43

  
38
            var errorCode = parameters.Get<int>("@ErrorCode");
39
            var error = parameters.Get<string>("@Error");
44
            var errorCode = parameters.Get<int>("ErrorCode");
45
            var error = parameters.Get<string>("Error");
40 46

  
41 47
            if (errorCode > 0)
42 48
            {
......
45 51
            }
46 52
            else
47 53
            {
48
                result = parameters.Get<string>("@NewID");
49 54
                tran.Commit();
55

  
56
                result = parameters.Get<string>("NewID");
50 57
            }
51 58

  
52 59
            return result;
ConvertService/ServiceBase/Markus.Service.DataBase.Dapper/Repositories/DOCPAGERepository.cs
34 34
				var items = docPages.Select(x => new InsertDocPage { DOCINFO_ID = x.DOCINFO_ID,PAGE_NUMBER = x.PAGE_NUMBER, PAGE_ANGLE = x.PAGE_ANGLE, PAGE_HEIGHT = x.PAGE_HEIGHT, PAGE_WIDTH = x.PAGE_WIDTH }).ToList();
35 35

  
36 36

  
37
				parameter.AddTable("@DOCPAGES", "TYPE_INSERT_DOCPAGE", items);
37
				parameter.AddTable("DOCPAGES", "TYPE_INSERT_DOCPAGE", items);
38 38

  
39 39
				var id = await base.ExecuteAsync("CONVERT_INSERT_DOCPAGE", parameter, tran, commandType: CommandType.StoredProcedure);
40 40

  
ConvertService/ServiceBase/Markus.Service.DataBase.Dapper/Repositories/DOCUMENTITEMRepository.cs
20 20

  
21 21
        public async Task<DOCUMENTITEM> GetFirstAsync(string projectNo, string documentID)
22 22
        {
23
            string SQL = "SELECT * FROM CDOCUMENT_ITEM WHERE PROJECT_NO = @PROJECT_NO AND DOCUMENT_ID = @DOCUMENT_ID";
23
            string SQL = "SELECT * FROM CDOCUMENT_ITEM WHERE PROJECT_NO = PROJECT_NO AND DOCUMENT_ID = DOCUMENT_ID";
24 24

  
25
            var parameter = new DynamicParameters();
26
            parameter.Add("@PROJECT_NO", projectNo, System.Data.DbType.String);
27
            parameter.Add("@DOCUMENT_ID", documentID, System.Data.DbType.String);
25
            var parameter = new MixParameters(DBMS);
26
            parameter.Add("PROJECT_NO", projectNo);
27
            parameter.Add("DOCUMENT_ID", documentID);
28 28

  
29 29
            return await base.GetFirstAsync<DOCUMENTITEM>(SQL, parameter);
30 30
        }
......
39 39
            string result = null;
40 40

  
41 41
            var tran = BeginTransaction();
42
            var parameter = new DynamicParameters();
42
            var parameter = new MixParameters(DBMS);
43 43

  
44
            parameter.Add("@REVISION", documentItem.REVISION, DbType.String);
45
            parameter.Add("@DOCUMENT_NO", documentItem.DOCUMENT_NO, DbType.String);
46
            parameter.Add("@DOCUMENT_NAME", documentItem.DOCUMENT_NAME, DbType.String);
47
            parameter.Add("@ORIGINAL_FILE", documentItem.ORIGINAL_FILE, DbType.String);
48
            parameter.Add("@DOCUMENT_ID", documentItem.DOCUMENT_ID, DbType.String);
49
            parameter.Add("@PROJECT_NO", documentItem.PROJECT_NO, DbType.String);
50
            parameter.Add("@Link", documentItem.PROJECT_NO, DbType.String);
51
            parameter.Add("@RESULT_FILE", documentItem.RESULT_FILE, DbType.String);
52
            parameter.Add("@RESULT", documentItem.RESULT, DbType.String);
53
            parameter.Add("@GROUP_NO", documentItem.GROUP_NO, DbType.String);
54
            parameter.Add("@NewID", dbType: DbType.String, direction: ParameterDirection.Output, size: 50);
44
            parameter.Add("REVISION", documentItem.REVISION);
45
            parameter.Add("DOCUMENT_NO", documentItem.DOCUMENT_NO);
46
            parameter.Add("DOCUMENT_NAME", documentItem.DOCUMENT_NAME);
47
            parameter.Add("ORIGINAL_FILE", documentItem.ORIGINAL_FILE);
48
            parameter.Add("DOCUMENT_ID", documentItem.DOCUMENT_ID);
49
            parameter.Add("PROJECT_NO", documentItem.PROJECT_NO);
50
            parameter.Add("Link", documentItem.PROJECT_NO);
51
            parameter.Add("RESULT_FILE", documentItem.RESULT_FILE);
52
            parameter.Add("RESULT", documentItem.RESULT);
53
            parameter.Add("GROUP_NO", documentItem.GROUP_NO);
54
            parameter.Add("NewID", dbType: DbType.String, direction: ParameterDirection.Output, size: 50);
55 55

  
56 56
            await base.ExecuteAsync("CONVERT_INSERT_DOCUMENTITEM", parameter, tran, commandType: CommandType.StoredProcedure);
57 57

  
58
            result = parameter.Get<string>("@NewID");
59

  
60 58
            tran.Commit();
61 59

  
60
            result = parameter.Get<string>("NewID");
61

  
62

  
62 63
            return result;
63 64
        }
64 65
    }
ConvertService/ServiceBase/Markus.Service.DataBase.Dapper/Repositories/PROPERTIESRepository.cs
26 26
            List<PROPERTIES> list = null;
27 27
            string SQL = "SELECT ID, TYPE, PROPERTY, VALUE FROM PROPERTIES WHERE ";
28 28

  
29
            var parameters = new DynamicParameters();
30
            parameters.Add("@PROPERTY", PROPERTY, System.Data.DbType.String);
31
            parameters.Add("@TYPE", TYPE, System.Data.DbType.String);
29
            var parameters = new MixParameters(DBMS);
30
            parameters.Add("PROPERTY", PROPERTY);
31
            parameters.Add("TYPE", TYPE);
32 32

  
33 33
            var result = await base.QueryAsync<PROPERTIES>(SQL, parameters);
34 34

  
......
38 38
        }
39 39
        public async Task<PROPERTIES> GetFirstAsync(string PROPERTY, string TYPE)
40 40
        {
41
            string SQL = "SELECT ID, TYPE, PROPERTY, VALUE FROM PROPERTIES WHERE PROPERTY = @PROPERTY AND TYPE = @TYPE";
41
            string SQL = "SELECT ID, TYPE, PROPERTY, VALUE FROM PROPERTIES WHERE PROPERTY = PROPERTY AND TYPE = TYPE";
42 42

  
43
            var parameters = new DynamicParameters();
44
            parameters.Add("@PROPERTY", PROPERTY, System.Data.DbType.String);
45
            parameters.Add("@TYPE", TYPE, System.Data.DbType.String);
43
            var parameters = new MixParameters(DBMS);
44
            parameters.Add("PROPERTY", PROPERTY);
45
            parameters.Add("TYPE", TYPE);
46 46

  
47 47
            return await base.GetFirstAsync<PROPERTIES>(SQL, parameters);
48 48
        }
ConvertService/ServiceBase/Markus.Service.DataBase.Dapper/Repositories/SERVICEPROPERTIESRepository.cs
36 36

  
37 37
        public async Task<SERVICEPROPERTIES> GetSingleAsync(string ServiceID)
38 38
        {
39
            string sql = "SELECT * FROM SERVICE_PROPERTIES WHERE ID = @SERVICE_ID";
39
            string sql = "SELECT * FROM SERVICE_PROPERTIES WHERE ID = SERVICE_ID";
40 40

  
41
            var parameter = new DynamicParameters();
42
            parameter.Add("@SERVICE_ID", ServiceID, DbType.String);
41
            var parameter = new MixParameters(DBMS);
42
            parameter.Add("SERVICE_ID", ServiceID);
43 43

  
44 44
            var result = await base.GetFirstAsync<SERVICEPROPERTIES>(sql, parameter);
45 45

  
ConvertService/ServiceBase/Markus.Service.DataBase.Test/DataBaseConvertDoc.cs
30 30

  
31 31

  
32 32
        [Test, Description("GetConvertDocSingle Test")]
33
        private void GetConvertDocSingle()
33
        public void GetConvertDocSingle()
34 34
        {
35 35
            using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr,dbtype))
36 36
            {
......
39 39
                    var convertDoc = repository.GetConvertDocSingleAsync(ProjectNo, ConvertID: convertDocID).GetAwaiter().GetResult();
40 40

  
41 41
                    Console.WriteLine($"ID : {convertDoc.ID} PROJECT_NO:{convertDoc.PROJECT_NO} DOCUMENT_URL:{convertDoc.DOCUMENT_URL} DOCUMENT_ID:{convertDoc.DOCUMENT_ID}  ConvertPath:{convertDoc.ConvertPath}  ");
42
                    break;
42 43
                }
43 44
                   
44 45
            }
......
63 64
                }
64 65
            }
65 66
        }
67

  
68
        [Test, Description("Select waitOrError msSQL Test")]
69
        public void SelectWaitOrError()
70
        {
71
            using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr, dbtype))
72
            {
73
                var items = repository.GetWaitorErrorAsync(2).GetAwaiter().GetResult();
74

  
75
                foreach (var item in items)
76
                {
77
                    Assert.Pass(item.ID);
78
                }
79
            }
80
        }
66 81
    }
67 82
}
ConvertService/ServiceBase/Markus.Service.DataBase.Test/DataBaseConvertDocPG.cs
29 29

  
30 30

  
31 31
        [Test, Description("GetConvertDocSingle Test")]
32
        private void GetConvertDocSingle()
32
        public void GetConvertDocSingle()
33 33
        {
34 34
            using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr, dbtype))
35 35
            {
......
49 49
            using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr, dbtype))
50 50
            {
51 51
                string sql = @"SELECT ID, PROJECT_NO, DOCUMENT_URL, DOCUMENT_ID, CREATE_DATETIME, STATUS, TOTAL_PAGE, CURRENT_PAGE, EXCEPTION, END_DATETIME, START_DATETIME, SERVICE_ID,"
52
                             + "RECONVERTER FROM CONVERTER_DOC where CREATE_DATETIME >= @CREATE_DATETIME order by CREATE_DATETIME desc limit 10";
52
                             + "RECONVERTER FROM CONVERTER_DOC where CREATE_DATETIME >= CREATE_DATETIME order by CREATE_DATETIME desc limit 10";
53 53
               
54 54
                var parameter = new List<sqlParameter>();
55
                parameter.Add(new sqlParameter("@CREATE_DATETIME", DateTime.Now.AddDays(-10), System.Data.DbType.DateTime));
55
                parameter.Add(new sqlParameter("CREATE_DATETIME", DateTime.Now.AddDays(-10), System.Data.DbType.DateTime));
56 56
  
57 57
               var items = repository.GetAsync<Markus.Service.DataBase.Entities.ConvertDoc>(sql, parameter).GetAwaiter().GetResult();
58 58

  
......
62 62
                }
63 63
            }
64 64
        }
65

  
66

  
67
        [Test, Description("Select waitOrError PostgreSQL Test")]
68
        public void SelectWaitOrError()
69
        {
70
            using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr, dbtype))
71
            {
72
                var items = repository.GetWaitorErrorAsync(2).GetAwaiter().GetResult();
73

  
74
                foreach (var item in items)
75
                {
76
                    Assert.Pass(item.ID);
77
                }
78
            }
79
        }
80

  
81
        [Test, Description("SetCleanUpItem PostgreSQL Test")]
82
        public void SelectSetCleanUpItem()
83
        {
84
            foreach (var item in newConvertDocIDs)
85
            {
86
                using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr, dbtype))
87
                {
88
                    var items = repository.SetCleanUpItemAsync(item,1).GetAwaiter().GetResult();
89

  
90
                    Assert.Pass(item);
91
                }
92
            }
93
        }
65 94
    }
66 95
}
ConvertService/ServiceBase/Markus.Service.DataBase.Test/DataBaseDocPage.cs
6 6
{
7 7
    public class DataBaseDocPage : TestBaseMSSQL
8 8
    {
9
        [Test, Description("")]
9
        //[Test, Description("")]
10 10
        public void DocPageInsert()
11 11
        {
12 12
            using (Markus.Service.DataBase.Repositories.DOCPAGERepository repository = new Repositories.DOCPAGERepository(ConnectionStr, dbtype))

내보내기 Unified diff

클립보드 이미지 추가 (최대 크기: 500 MB)