debugging
This commit is contained in:
17
DbService.cs
17
DbService.cs
@ -14,8 +14,9 @@ namespace de.hottis.genericdatabaseapiservice.Services {
|
||||
}
|
||||
|
||||
public class DbServiceException : Exception {}
|
||||
public class NotDataFoundException : DbServiceException {}
|
||||
public class NoDataFoundException : DbServiceException {}
|
||||
public class TooMuchDataFoundException : DbServiceException {}
|
||||
public class UnsupportedDataTypeException: DbServiceException {}
|
||||
|
||||
public class DbService : IDbService {
|
||||
private readonly IConfiguration Configuration;
|
||||
@ -68,11 +69,15 @@ namespace de.hottis.genericdatabaseapiservice.Services {
|
||||
propertyInfo.SetValue(item, null);
|
||||
Console.WriteLine("Output Value: null");
|
||||
} else if (propertyInfo.PropertyType == typeof(System.String)) {
|
||||
propertyInfo.SetValue(item, reader.GetString(ordinal));
|
||||
Console.WriteLine("Output Value:{0}", reader.GetString(ordinal));
|
||||
var value = reader.GetString(ordinal);
|
||||
propertyInfo.SetValue(item, value);
|
||||
Console.WriteLine("Output Value:{0}", value);
|
||||
} else if (propertyInfo.PropertyType == typeof(System.Int32)) {
|
||||
propertyInfo.SetValue(item, reader.GetInt32(ordinal));
|
||||
Console.WriteLine("Output Value:{0}", reader.GetInt32(ordinal));
|
||||
var value = reader.GetInt32(ordinal);
|
||||
propertyInfo.SetValue(item, value);
|
||||
Console.WriteLine("Output Value:{0}", value);
|
||||
} else {
|
||||
throw new UnsupportedDataTypeException();
|
||||
}
|
||||
}
|
||||
itemList.Add(item);
|
||||
@ -82,7 +87,7 @@ namespace de.hottis.genericdatabaseapiservice.Services {
|
||||
}
|
||||
|
||||
if (itemList.Count == 0) {
|
||||
throw new NotDataFoundException();
|
||||
throw new NoDataFoundException();
|
||||
}
|
||||
if (justOne && itemList.Count > 1) {
|
||||
throw new TooMuchDataFoundException();
|
||||
|
Reference in New Issue
Block a user