개정판 c1946e9c
issue #000 DOCPAGEREPO 수정.
Change-Id: I6163b8b26afb516e68b10ac5810590822260cd2f
ConvertService/ServiceBase/Markus.Service.DataBase.Dapper/Repositories/DOCPAGERepository.cs | ||
---|---|---|
25 | 25 |
{ |
26 | 26 |
public DOCPAGERepository(string connectionString, DBMSType DBMS) : base(connectionString, DBMS) |
27 | 27 |
{ |
28 |
if (this.DBMS == DBMSType.POSTGRESQL) |
|
29 |
if (NpgsqlConnection.GlobalTypeMapper.Mappings.Where(f => f.PgTypeName == "type_insert_docpage").Count() == 0) |
|
30 |
NpgsqlConnection.GlobalTypeMapper.MapComposite<InsertDocPage>("type_insert_docpage"); |
|
28 |
if (NpgsqlConnection.GlobalTypeMapper.Mappings.Where(f => f.PgTypeName == "type_insert_docpage").Count() == 0) |
|
29 |
NpgsqlConnection.GlobalTypeMapper.MapComposite<InsertDocPage>("type_insert_docpage"); |
|
31 | 30 |
|
32 | 31 |
} |
33 | 32 |
|
... | ... | |
54 | 53 |
result = true; |
55 | 54 |
} |
56 | 55 |
else if (this.DBMS == DBMSType.POSTGRESQL) |
57 |
{ |
|
58 |
var items = docPages.Select(x => new InsertDocPage {docinfo_id = x.ID, |
|
59 |
page_number = x.PAGE_NUMBER, |
|
60 |
page_angle = x.PAGE_ANGLE, |
|
61 |
page_height = x.PAGE_HEIGHT, |
|
62 |
page_width = x.PAGE_WIDTH }).ToArray(); |
|
56 |
{ |
|
57 |
var items = docPages.Select(x => new InsertDocPage |
|
58 |
{ |
|
59 |
docinfo_id = x.DOCINFO_ID, |
|
60 |
page_number = x.PAGE_NUMBER, |
|
61 |
page_angle = x.PAGE_ANGLE, |
|
62 |
page_height = x.PAGE_HEIGHT, |
|
63 |
page_width = x.PAGE_WIDTH |
|
64 |
}).ToArray< InsertDocPage>(); |
|
65 |
|
|
63 | 66 |
|
64 | 67 |
var tran = BeginTransaction(); |
65 | 68 |
NpgsqlCommand command = new NpgsqlCommand("convert_insert_docpage", (NpgsqlConnection)this.Connection); |
66 | 69 |
command.CommandType = CommandType.StoredProcedure; |
70 |
|
|
67 | 71 |
var cmdParam = command.CreateParameter(); |
68 | 72 |
cmdParam.ParameterName = "docpages"; |
69 | 73 |
cmdParam.DbType = DbType.Object; |
... | ... | |
88 | 92 |
return result; |
89 | 93 |
} |
90 | 94 |
|
91 |
|
|
95 |
// call stored procedure at data access layer for example StudentDAL.cs |
|
96 |
public void CallStoredResultSet<T>(InsertDocPage[] inputParameters) where T : class |
|
97 |
{ |
|
98 |
//var conn = _GetOpenConnection(); |
|
99 |
//var tran = _BeginTransaction(conn); |
|
100 |
|
|
101 |
var tran = BeginTransaction(); |
|
102 |
NpgsqlCommand command = new NpgsqlCommand("convert_insert_docpage", (NpgsqlConnection)this.Connection); |
|
103 |
command.CommandType = CommandType.StoredProcedure; |
|
104 |
|
|
105 |
var cmdParam = command.CreateParameter(); |
|
106 |
cmdParam.ParameterName = "docpages"; |
|
107 |
cmdParam.DbType = DbType.Object; |
|
108 |
cmdParam.Value = inputParameters; |
|
109 |
cmdParam.DataTypeName = "type_insert_docpage[]"; |
|
110 |
command.Parameters.Add(cmdParam); |
|
111 |
command.Transaction = (Npgsql.NpgsqlTransaction)tran; |
|
112 |
//await command.ExecuteNonQueryAsync(); |
|
113 |
tran.Commit(); |
|
114 |
|
|
115 |
|
|
116 |
} |
|
92 | 117 |
public class InsertDocPage |
93 | 118 |
{ |
94 | 119 |
[PgName("docinfo_id")] |
... | ... | |
101 | 126 |
public string page_height { get; set; } |
102 | 127 |
[PgName("page_angle")] |
103 | 128 |
public int page_angle { get; set; } |
129 |
|
|
130 |
public InsertDocPage() |
|
131 |
{ |
|
132 |
|
|
133 |
} |
|
104 | 134 |
} |
105 | 135 |
|
106 | 136 |
} |
ConvertService/ServiceBase/Markus.Service.DataBase.Test/DataBaseConvertDoc.cs | ||
---|---|---|
22 | 22 |
|
23 | 23 |
newConvertDocIDs.Add(newConvertDocID); |
24 | 24 |
Console.WriteLine($"new id : {newConvertDocID}"); |
25 |
Assert.Pass(newConvertDocID); |
|
25 |
|
|
26 | 26 |
var newConvertDocID2 = repository.CreateAsync(ProjectNo, docUri, "A1111111").GetAwaiter().GetResult(); |
27 | 27 |
|
28 | 28 |
newConvertDocIDs.Add(newConvertDocID2); |
... | ... | |
46 | 46 |
|
47 | 47 |
newConvertDocIDs.Add(newConvertDocID); |
48 | 48 |
Console.WriteLine($"new id : {newConvertDocID}"); |
49 |
Assert.Pass(newConvertDocID); |
|
50 | 49 |
|
51 | 50 |
var newConvertDocID2 = repository.Create(ProjectNo, docUri, "A1111111").GetAwaiter().GetResult(); |
52 | 51 |
|
ConvertService/ServiceBase/Markus.Service.DataBase.Test/DataBaseConvertDocPG.cs | ||
---|---|---|
23 | 23 |
|
24 | 24 |
newConvertDocIDs.Add(newConvertDocID); |
25 | 25 |
Console.WriteLine($"new id : {newConvertDocID}"); |
26 |
Assert.Pass(newConvertDocID); |
|
26 |
|
|
27 | 27 |
var newConvertDocID2 = repository.CreateAsync(ProjectNo, docUri, "A1111111").GetAwaiter().GetResult(); |
28 | 28 |
|
29 | 29 |
newConvertDocIDs.Add(newConvertDocID2); |
... | ... | |
46 | 46 |
|
47 | 47 |
newConvertDocIDs.Add(newConvertDocID); |
48 | 48 |
Console.WriteLine($"new id : {newConvertDocID}"); |
49 |
Assert.Pass(newConvertDocID); |
|
49 |
|
|
50 | 50 |
var newConvertDocID2 = repository.Create(ProjectNo, docUri, "A1111111").GetAwaiter().GetResult(); |
51 | 51 |
|
52 | 52 |
newConvertDocIDs.Add(newConvertDocID2); |
ConvertService/ServiceBase/Markus.Service.DataBase.Test/DataBaseDocInfo.cs | ||
---|---|---|
14 | 14 |
using (Markus.Service.DataBase.Repositories.ConvertDocRepository repository = new Repositories.ConvertDocRepository(ConnectionStr, dbtype)) { |
15 | 15 |
newConvertDocID = repository.CreateAsync(ProjectNo, docUri, "111111").GetAwaiter().GetResult(); |
16 | 16 |
Console.WriteLine($"new id : {newConvertDocID}"); |
17 |
Assert.Pass(newConvertDocID); |
|
17 |
|
|
18 | 18 |
} |
19 | 19 |
|
20 | 20 |
if (!string.IsNullOrEmpty(newConvertDocID)) { |
ConvertService/ServiceBase/Markus.Service.DataBase.Test/DataBaseDocInfoPG.cs | ||
---|---|---|
15 | 15 |
{ |
16 | 16 |
newConvertDocID = repository.CreateAsync(ProjectNo, docUri, "111111").GetAwaiter().GetResult(); |
17 | 17 |
Console.WriteLine($"new id : {newConvertDocID}"); |
18 |
Assert.Pass(newConvertDocID); |
|
18 |
|
|
19 | 19 |
} |
20 | 20 |
|
21 | 21 |
if (!string.IsNullOrEmpty(newConvertDocID)) |
ConvertService/ServiceBase/Markus.Service.DataBase.Test/DataBaseDocPage.cs | ||
---|---|---|
15 | 15 |
{ |
16 | 16 |
newConvertDocID = repository.CreateAsync(ProjectNo, docUri, "111111").GetAwaiter().GetResult(); |
17 | 17 |
Console.WriteLine($"new id : {newConvertDocID}"); |
18 |
Assert.Pass(newConvertDocID); |
|
19 | 18 |
} |
20 | 19 |
|
21 | 20 |
if (!string.IsNullOrEmpty(newConvertDocID)) |
... | ... | |
25 | 24 |
newDocInfo = repository.CreateAsync(newConvertDocID, 10).GetAwaiter().GetResult(); |
26 | 25 |
|
27 | 26 |
Console.WriteLine($"new id : {newDocInfo}"); |
28 |
Assert.Pass(newDocInfo); |
|
29 | 27 |
} |
30 | 28 |
|
31 | 29 |
|
... | ... | |
45 | 43 |
{ |
46 | 44 |
Assert.Pass(); |
47 | 45 |
} |
48 |
else |
|
49 |
{ |
|
50 |
Assert.Fail(); |
|
51 |
} |
|
46 |
|
|
47 |
|
|
52 | 48 |
} |
53 | 49 |
} |
54 |
else |
|
55 |
{ |
|
56 |
Assert.Fail(); |
|
57 |
} |
|
58 | 50 |
} |
59 |
|
|
51 |
Assert.Fail(); |
|
60 | 52 |
} |
61 | 53 |
} |
62 | 54 |
} |
ConvertService/ServiceBase/Markus.Service.DataBase.Test/DataBaseDocPagePG.cs | ||
---|---|---|
16 | 16 |
{ |
17 | 17 |
newConvertDocID = repository.CreateAsync(ProjectNo, docUri, "111111").GetAwaiter().GetResult(); |
18 | 18 |
Console.WriteLine($"new id : {newConvertDocID}"); |
19 |
Assert.Pass(newConvertDocID); |
|
20 | 19 |
} |
21 | 20 |
|
22 | 21 |
if (!string.IsNullOrEmpty(newConvertDocID)) |
... | ... | |
26 | 25 |
newDocInfo = repository.CreateAsync(newConvertDocID, 10).GetAwaiter().GetResult(); |
27 | 26 |
|
28 | 27 |
Console.WriteLine($"new id : {newDocInfo}"); |
29 |
Assert.Pass(newDocInfo); |
|
30 | 28 |
} |
31 | 29 |
|
32 | 30 |
|
... | ... | |
36 | 34 |
{ |
37 | 35 |
List<Entities.DOCPAGE> pages = new List<Entities.DOCPAGE>(); |
38 | 36 |
|
39 |
for (int i = 0; i < 1000; i++)
|
|
37 |
for (int i = 0; i < 20000; i++)
|
|
40 | 38 |
{ |
41 | 39 |
pages.Add(new Entities.DOCPAGE { DOCINFO_ID = newDocInfo, PAGE_NUMBER = i + 1, PAGE_WIDTH = "1210", PAGE_HEIGHT = "1210", PAGE_ANGLE = 0 }); |
42 | 40 |
} |
... | ... | |
46 | 44 |
{ |
47 | 45 |
Assert.Pass(); |
48 | 46 |
} |
49 |
else |
|
50 |
{ |
|
51 |
Assert.Fail(); |
|
52 |
} |
|
47 |
|
|
48 |
|
|
53 | 49 |
} |
54 | 50 |
} |
55 |
else |
|
56 |
{ |
|
57 |
Assert.Fail(); |
|
58 |
} |
|
59 | 51 |
} |
60 |
|
|
52 |
Assert.Fail(); |
|
61 | 53 |
} |
62 | 54 |
} |
63 | 55 |
} |
내보내기 Unified diff