Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Query Rgearding Fetch data from multiple tables in ServiceStack ORMLite #2487

Open
SharmaRohit22 opened this issue May 6, 2024 · 0 comments

Comments

@SharmaRohit22
Copy link

SharmaRohit22 commented May 6, 2024

Problem Statement:
The ORMLite framework in Azure Function with.NET 8 is what we're using to fetch data from multiple tables using SQL joins and select into a single model. However, when I run this query, the only table that returns is NoteTemplateFolders, even though I want the data from every table that I select in the SQL expression.

Please provide guidance and possible solutions for the above mentioned scenario.

My Code:

SqlExpression<NoteTemplateFolders> sqlExpression = _tenantDatabase.From<NoteTemplateFolders>()
    .Join<NoteTemplateFolders, NoteTemplates>((folder, template) => folder.Id == template.FolderId)
    .Where<NoteTemplates>(x => x.Name == "Template 342079")
    .Select<NoteTemplateFolders, NoteTemplates>((folder, template) => new
    {
        FolderId = folder.Id,
        FolderName = folder.Name,
        Id = template.Id,
        Name = template.Name,
        ClientName = "Test"
    });

List<NoteTemplateFolders> response = _tenantDatabase.Select(sqlExpression);
@liliankasem liliankasem transferred this issue from Azure/azure-functions-dotnet-worker May 8, 2024
@MaddyDev MaddyDev transferred this issue from Azure/azure-functions-sql-extension May 29, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant