Apache
Apache
CC#
Created by Apache on 4/17/2024 in #help
AspNetCore `net8.0` - Blazor {*CatchAll} route overrides MVC AdminController route
I'm using a Blazor8 with OrchardCore as a de-coupled CMS. I want /admin* to be routed by Orchard, and the rest to be routed by Blazor. Using this as a basic working example: https://github.com/ApacheTech/BlazOrchard If I have a page with @page "/{*Slug}";, I want to give priority to /admin to run through the MVC Area controller. It seems that Blazor strips all power away from MVC to route itself. I want Blazor to be the fallback.
3 replies
CC#
Created by Apache on 4/11/2024 in #help
Migrating WSDL imports via ServiceDescriptionImporter from Framework to Core
I'm writing documentation website for a backwards compatible API. I'm migrating code from .NET Framework 4.7.2, to .NET8. In net472, we get the results of any given WSDL URL, read it into a System.Web.Services.Description.ServiceDescription, check if there are any warnings with a System.Web.Services.Description.ServiceDescriptionImporter, create an assembly in memory, with Microsoft.CSharp.CSharpCodeProvider, and then read the System.Type from the assembly via reflection. A lot of this has been ripped out of BCL in Core. Both SOAP and WCF are both depreciated, but a lot of our clients still use the SOAP services on legacy projects; so we need to keep them up, and documented. But, we also need to move on tech-stack wise. So, I'm wondering what the options are. Ideally, some wonderful person will have created a NuGet library that would wrap all of this up, and make it all magically work within net8.0. But, failing the coming of a saviour, how else would it be possible to programmatically resolve a System.Type from any given WSDL URL?
34 replies
CC#
Created by Apache on 3/29/2024 in #help
CROSS APPLY within LINQ
Is there a tool I can use to directly map SQL to LINQ? I have a query that I'm not sure how to translate. Here's the SQL:
SELECT [f].[FileName], [a].[ClientName], [f].[FilenameRegex], [f].[Usernames], [f].[RateLimit], [t0].[AssignmentId], [t0].[TimeIssued], [t0].[TimeCompleted], [t0].[Status]
FROM [AssignmentDetails] AS [f]
INNER JOIN [Assignment] as [a] ON [f].[FileName] = [a].[FileName]
CROSS APPLY (SELECT TOP 1 * FROM Assignments WHERE FileName = w.FileName ORDER BY AssignmentId DESC) t0
WHERE [a].[ClientName] = "Apache"
SELECT [f].[FileName], [a].[ClientName], [f].[FilenameRegex], [f].[Usernames], [f].[RateLimit], [t0].[AssignmentId], [t0].[TimeIssued], [t0].[TimeCompleted], [t0].[Status]
FROM [AssignmentDetails] AS [f]
INNER JOIN [Assignment] as [a] ON [f].[FileName] = [a].[FileName]
CROSS APPLY (SELECT TOP 1 * FROM Assignments WHERE FileName = w.FileName ORDER BY AssignmentId DESC) t0
WHERE [a].[ClientName] = "Apache"
I can't figure out how to do CROSS APPLY within LINQ. This was my attempt, but it creates a horrible web of SQL that traverses the entire Assignments table just to find a single record.
var assignmentSummaries = ctx.AssignmentDetails
.Where(a => a.Assignment.ClientName == command.ClientName)
.Select(a => new AssigmentDetailsViewModel()
{
FileName = a.FileName,
ClientName = a.Assignment.ClientName,
AssignmentDetails = new()
{
FilenameRegex = a.FilenameRegex,
RateLimit = a.RateLimit,
Usernames = a.Usernames,

},
LatestFile = a.Assignment.Files
.OrderByDescending(f => f.AssignmentId)
.Select(f => new AssignmentFile()
{
AssignmentId = f.AssignmentId,
TimeIssued = f.TimeIssued,
TimeCompleted = f.TimeCompleted,
Status = f.Status,
})
.Take(1)
})
.ToList();
var assignmentSummaries = ctx.AssignmentDetails
.Where(a => a.Assignment.ClientName == command.ClientName)
.Select(a => new AssigmentDetailsViewModel()
{
FileName = a.FileName,
ClientName = a.Assignment.ClientName,
AssignmentDetails = new()
{
FilenameRegex = a.FilenameRegex,
RateLimit = a.RateLimit,
Usernames = a.Usernames,

},
LatestFile = a.Assignment.Files
.OrderByDescending(f => f.AssignmentId)
.Select(f => new AssignmentFile()
{
AssignmentId = f.AssignmentId,
TimeIssued = f.TimeIssued,
TimeCompleted = f.TimeCompleted,
Status = f.Status,
})
.Take(1)
})
.ToList();
The only way we've found that works so far is to not add the LatestFile here, and run a client-side foreach loop after we get the results.
6 replies