개정판 7864cac7
issue #000 DocPageRepository 변경.
Change-Id: I9f48bc0c597022a9fe2e3a5e4ef42a05a7a445ea
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 |
|
|
29 |
} |
|
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"); |
|
31 |
|
|
32 |
} |
|
30 | 33 |
|
31 |
public async Task<bool> CreateAsync(IEnumerable<DOCPAGE> docPages)
|
|
34 |
public async Task<bool> CreateAsync(IEnumerable<DOCPAGE> docPages)
|
|
32 | 35 |
{ |
33 | 36 |
bool result = false; |
34 | 37 |
|
... | ... | |
52 | 55 |
} |
53 | 56 |
else if (this.DBMS == DBMSType.POSTGRESQL) |
54 | 57 |
{ |
55 |
if (NpgsqlConnection.GlobalTypeMapper.Mappings.Where(f => f.PgTypeName == "type_insert_docpage").Count() == 0) |
|
56 |
NpgsqlConnection.GlobalTypeMapper.MapComposite<InsertDocPage>("type_insert_docpage"); |
|
57 |
|
|
58 |
InsertDocPage[] items = docPages.Select(x => new InsertDocPage {docinfo_id = x.DOCINFO_ID, |
|
58 |
var items = docPages.Select(x => new InsertDocPage {docinfo_id = "18ebea66498c4a84b9a564c34c426ef7", |
|
59 | 59 |
page_number = x.PAGE_NUMBER, |
60 | 60 |
page_angle = x.PAGE_ANGLE, |
61 | 61 |
page_height = x.PAGE_HEIGHT, |
... | ... | |
70 | 70 |
cmdParam.Value = items; |
71 | 71 |
cmdParam.DataTypeName = "type_insert_docpage[]"; |
72 | 72 |
command.Parameters.Add(cmdParam); |
73 |
command.Transaction = (Npgsql.NpgsqlTransaction)tran; |
|
73 | 74 |
await command.ExecuteNonQueryAsync(); |
74 | 75 |
tran.Commit(); |
75 | 76 |
result = true; |
... | ... | |
96 | 97 |
var tran = BeginTransaction(); |
97 | 98 |
NpgsqlCommand command = new NpgsqlCommand("convert_insert_docpage_arr", (NpgsqlConnection)this.Connection ); |
98 | 99 |
command.CommandType = CommandType.StoredProcedure; |
100 |
|
|
99 | 101 |
var cmdParam = command.CreateParameter(); |
100 | 102 |
cmdParam.ParameterName = "docpages"; |
101 | 103 |
cmdParam.DbType = DbType.Object; |
102 | 104 |
cmdParam.Value = inputParameters; |
103 | 105 |
cmdParam.DataTypeName = "type_insert_docpage[]"; |
104 |
|
|
105 | 106 |
command.Parameters.Add(cmdParam); |
106 |
|
|
107 |
// throw exception here |
|
108 |
// Can't write CLR type Web.API.Models.UdtSpParameter[] with handler type MappedCompositeHandler`1 |
|
109 | 107 |
command.ExecuteNonQueryAsync(); |
110 | 108 |
tran.Commit(); |
111 |
//this.Connection.Close(); |
|
112 | 109 |
|
113 | 110 |
|
114 | 111 |
} |
내보내기 Unified diff