datamemberattribute

This commit is contained in:
Wolfgang Hottgenroth 2021-11-24 12:28:45 +01:00
parent 6a0424d9f1
commit 1bc9349f60
Signed by: wn
GPG Key ID: E49AF3B9EF6DD469
3 changed files with 7 additions and 2 deletions

1
.gitignore vendored
View File

@ -1,3 +1,4 @@
.vscode/
output/ output/
__pycache__ __pycache__
regular.cs regular.cs

View File

@ -1,5 +1,6 @@
using System; using System;
using System.Collections.Generic; using System.Collections.Generic;
using System.Runtime.Serialization;
using MySqlConnector; using MySqlConnector;
using de.hottis.genericdatabaseapiservice.Models; using de.hottis.genericdatabaseapiservice.Models;
@ -27,7 +28,10 @@ namespace de.hottis.genericdatabaseapiservice.Services {
using (var reader = await cmd.ExecuteReaderAsync()) { using (var reader = await cmd.ExecuteReaderAsync()) {
while (await reader.ReadAsync()) { while (await reader.ReadAsync()) {
foreach (var propertyInfo in typeof(T).GetProperties()) { foreach (var propertyInfo in typeof(T).GetProperties()) {
Console.WriteLine(propertyInfo); Console.WriteLine("Property name: {0}", propertyInfo);
var attributes = propertyInfo.GetCustomAttributes(typeof(DataMemberAttribute), true);
var dma = (DataMemberAttribute)attributes[0];
Console.WriteLine("DataMember name: {0} {1} ", dma.Name, dma.TypeId);
} }
Console.WriteLine(reader.GetString("txt")); Console.WriteLine(reader.GetString("txt"));
} }

View File

@ -45,7 +45,7 @@ $paramsInputType['type'] $paramsInputType['name'] #slurp
[FromBody]$operation['bodyInputType']['csName'] $operation['bodyInputType']['apiName'] #slurp [FromBody]$operation['bodyInputType']['csName'] $operation['bodyInputType']['apiName'] #slurp
#end if #end if
) { ) {
_dbService.JustDoSomething("Hello ${operation['func']}"); _dbService.JustDoSomething<$operation['resultType']['csName']>("Hello ${operation['func']}");
// Statement: // Statement:
#if not $operation['statement'] #if not $operation['statement']