fix: avoid loading service manager module
This commit is contained in:
@@ -296,7 +296,11 @@ namespace C4IT.F4SD
|
||||
public async Task<HttpResponseMessage> getPickup(string name, [FromUri] EntityEnumerationVisibilityMode mode = EntityEnumerationVisibilityMode.None, [FromUri] Int32 group = -1)
|
||||
{
|
||||
await Task.Delay(0);
|
||||
EntityEnumeration enumerationTemp = GetEnumeration(name, mode);
|
||||
var pickupName = ResolvePickupName(name);
|
||||
if (string.IsNullOrWhiteSpace(pickupName))
|
||||
return HttpResponseExtensions.CreateResponse(Request, HttpStatusCode.BadRequest, "Pickup name is required.");
|
||||
|
||||
EntityEnumeration enumerationTemp = GetEnumeration(pickupName, mode);
|
||||
var vals = enumerationTemp.Values;
|
||||
|
||||
if (group > -1)
|
||||
@@ -395,6 +399,7 @@ namespace C4IT.F4SD
|
||||
|
||||
private EntityEnumeration GetEnumeration(string name, EntityEnumerationVisibilityMode mode)
|
||||
{
|
||||
name = name?.Trim();
|
||||
var dataTable = GetEnumerationProvider().GetEnumeration(name, GetVisibilityFilter(mode));
|
||||
if (dataTable == null)
|
||||
throw new InvalidOperationException($"Enumeration '{name}' was not found.");
|
||||
@@ -427,6 +432,20 @@ namespace C4IT.F4SD
|
||||
};
|
||||
}
|
||||
|
||||
private string ResolvePickupName(string routeName)
|
||||
{
|
||||
if (!string.IsNullOrWhiteSpace(routeName))
|
||||
return routeName.Trim();
|
||||
|
||||
var pathSegment = Request?.RequestUri?.Segments?
|
||||
.LastOrDefault(segment => !string.IsNullOrWhiteSpace(segment) && segment != "/");
|
||||
|
||||
if (string.IsNullOrWhiteSpace(pathSegment))
|
||||
return null;
|
||||
|
||||
return Uri.UnescapeDataString(pathSegment.Trim('/'));
|
||||
}
|
||||
|
||||
private static bool? GetVisibilityFilter(EntityEnumerationVisibilityMode mode)
|
||||
{
|
||||
switch (mode)
|
||||
|
||||
Reference in New Issue
Block a user