WiredViews.Xperience.QueryExtensions 1.0.0

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
Suggested Alternatives

XperienceCommunity.QueryExtensions

Additional Details

This package has been renamed to XperienceCommunity.QueryExtensions

The owner has unlisted this package. This could mean that the package is deprecated, has security vulnerabilities or shouldn't be used anymore.
dotnet add package WiredViews.Xperience.QueryExtensions --version 1.0.0
NuGet\Install-Package WiredViews.Xperience.QueryExtensions -Version 1.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="WiredViews.Xperience.QueryExtensions" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add WiredViews.Xperience.QueryExtensions --version 1.0.0
#r "nuget: WiredViews.Xperience.QueryExtensions, 1.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install WiredViews.Xperience.QueryExtensions as a Cake Addin
#addin nuget:?package=WiredViews.Xperience.QueryExtensions&version=1.0.0

// Install WiredViews.Xperience.QueryExtensions as a Cake Tool
#tool nuget:?package=WiredViews.Xperience.QueryExtensions&version=1.0.0

Xperience Query Extensions

NuGet Package

This package provides a set of extension methods for Kentico Xperience 13.0 DocumentQuery, MultiDocumentQuery, and ObjectQuery data access APIs.

Dependencies

This package is compatible with ASP.NET Core 3.1 → ASP.NET Core 5 applications or libraries integrated with Kentico Xperience 13.0.

How to Use?

  1. Install the NuGet package in your ASP.NET Core project (or class library)

    dotnet add package WiredViews.Xperience.QueryExtensions
    
  2. The extension methods are all in the CMS.DocumentEngine and CMS.DataEngine namespaces, so assuming you have the package installed you should see them appear in Intellisense.

Extension Method Examples

DocumentQuery

public void QueryDocument(Guid nodeGuid)
{
    var query = DocumentHelper.GetDocuments()
        .WhereNodeGUIDEquals(nodeGuid);
}
var query = DocumentHelper.GetDocuments()
    .OrderByNodeOrder();
var query = DocumentHelper.GetDocuments()
    .OrderByDescending(nameof(TreeNode.NodeID))
    .TopN(1)
    .DebugQuery();

/*
~~~ BEGIN [path\to\your\app\Program.cs] QUERY ~~~


DECLARE @DocumentCulture nvarchar(max) = N'en-US';

SELECT TOP 1 *
FROM View_CMS_Tree_Joined AS V WITH (NOLOCK, NOEXPAND) LEFT OUTER JOIN COM_SKU AS S WITH (NOLOCK) ON [V].[NodeSKUID] = [S].[SKUID]
WHERE [DocumentCulture] = @DocumentCulture
ORDER BY NodeID DESC


~~~ END [path\to\your\app\Program.cs] QUERY ~~~
*/
var query = DocumentHelper.GetDocuments()
    .OrderByDescending(nameof(TreeNode.NodeID))
    .TopN(1)
    .DebugQuery("Newest Document");

/*
~~~ BEGIN [Newest Document] QUERY ~~~


DECLARE @DocumentCulture nvarchar(max) = N'en-US';

SELECT TOP 1 *
FROM View_CMS_Tree_Joined AS V WITH (NOLOCK, NOEXPAND) LEFT OUTER JOIN COM_SKU AS S WITH (NOLOCK) ON [V].[NodeSKUID] = [S].[SKUID]
WHERE [DocumentCulture] = @DocumentCulture
ORDER BY NodeID DESC


~~~ END [Newest Document] QUERY ~~~
*/
public void QueryDatabase(ILogger logger)
{
    var query = DocumentHelper.GetDocuments()
        .OrderByDescending(nameof(TreeNode.NodeID))
        .TopN(1)
        .LogQuery(logger, "Logged Query");
}
public async Task QueryDatabase(CancellationToken token)
{
    List<TreeNode> pages = await DocumentHelper.GetDocuments()
        .TopN(5)
        .ToListAsync(token);
}
public async Task QueryDatabase(CancellationToken token)
{
    TreeNode? newestPage = await DocumentHelper.GetDocuments()
        .OrderByDescending(nameof(TreeNode.NodeID))
        .TopN(1)
        .FirstOrDefaultAsync(token);

    if (newestPage is null)
    {
        return;
    }

    // ...
}

ObjectQuery

var query = UserInfo.Provider.Get()
    .OrderByDescending(nameof(UserInfo.UserLastModified))
    .TopN(1)
    .DebugQuery();

/*
~~~ BEGIN [path\to\your\app\Program.cs] QUERY ~~~


SELECT TOP 1 *
FROM CMS_User
ORDER BY UserLastModified DESC


~~~ END [path\to\your\app\Program.cs] QUERY ~~~
*/
var query = UserInfo.Provider.Get()
    .OrderByDescending(nameof(UserInfo.UserLastModified))
    .TopN(1)
    .DebugQuery("User");

/*
~~~ QUERY [User] START ~~~


SELECT TOP 1 *
FROM CMS_User
ORDER BY UserLastModified DESC


~~~ QUERY [User] END ~~~
*/
public void QueryDatabase(ILogger logger)
{
    var query = UserInfo.Provider.Get()
        .OrderByDescending(nameof(UserInfo.UserLastModified))
        .TopN(1)
        .LogQuery(logger, "Logged User Query");
}
public async Task QueryDatabase(CancellationToken token)
{
    List<UserInfo> recentlyUpdatedUsers = await UserInfo.Provider.Get()
        .OrderByDesc(nameof(UserInfo.UserLastModified))
        .TopN(10)
        .ToListAsync(token);
}
public async Task QueryDatabase(CancellationToken token)
{
    UserInfo? user = await UserInfo.Provider.Get()
        .OrderByDesc(nameof(UserInfo.UserLastModified))
        .TopN(1)
        .FirstOrDefaultAsync(token);

    if (user is null)
    {
        return;
    }

    // ...
}

References

.NET

Kentico Xperience

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp3.1 is compatible. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated