Microsoft.SqlServer.XEvent.XELite 2023.1.30.3

The ID prefix of this package has been reserved for one of the owners of this package by NuGet.org. Prefix Reserved
.NET 6.0 .NET Standard 2.0 .NET Framework 4.6.2
dotnet add package Microsoft.SqlServer.XEvent.XELite --version 2023.1.30.3
NuGet\Install-Package Microsoft.SqlServer.XEvent.XELite -Version 2023.1.30.3
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="Microsoft.SqlServer.XEvent.XELite" Version="2023.1.30.3" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Microsoft.SqlServer.XEvent.XELite --version 2023.1.30.3
#r "nuget: Microsoft.SqlServer.XEvent.XELite, 2023.1.30.3"
#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 Microsoft.SqlServer.XEvent.XELite as a Cake Addin
#addin nuget:?package=Microsoft.SqlServer.XEvent.XELite&version=2023.1.30.3

// Install Microsoft.SqlServer.XEvent.XELite as a Cake Tool
#tool nuget:?package=Microsoft.SqlServer.XEvent.XELite&version=2023.1.30.3

Introduction

XELite is cross platform library to read XEvents from XEL files or live SQL streams.

Getting Started

Using XELite to parse XEL files

static void OutputXELFile(string fileName)
{
	var xeStream = new XEFileEventStreamer(fileName);

	xeStream.ReadEventStream(
		() => {
			Console.WriteLine("Headers found");
			return Task.CompletedTask;
		},
		xevent => {
			Console.WriteLine(xevent);
			Console.WriteLine("");
			return Task.CompletedTask;
		},
		CancellationToken.None).Wait();
}

Using XELite to connect to live event session

Step 1: Create & start event session. For example:

CREATE EVENT SESSION [sample_session] ON SERVER 
ADD EVENT sqlserver.sql_statement_completed(
    ACTION(sqlserver.sql_text))
GO

ALTER EVENT SESSION [sample_session] ON SERVER 
	STATE = START
GO

Step 2: Implement the code to connect and read the events. Here is a sample:

static void OutputXELStream(string connectionString, string sessionName)
{
    var cancellationTokenSource = new CancellationTokenSource();

    var xeStream = new XELiveEventStreamer(connectionString, sessionName);

    Console.WriteLine("Press any key to stop listening...");
    Task waitTask = Task.Run(() =>
        {
            Console.ReadKey();
            cancellationTokenSource.Cancel();
        });

    Task readTask = xeStream.ReadEventStream(() =>
        {
            Console.WriteLine("Connected to session");
            return Task.CompletedTask;
        },
        xevent =>
        {
            Console.WriteLine(xevent);
            Console.WriteLine("");
            return Task.CompletedTask;
        },
        cancellationTokenSource.Token);


    try
    {
        Task.WaitAny(waitTask, readTask);
    }
    catch (TaskCanceledException)
    {
    }

    if (readTask.IsFaulted)
    {
        Console.Error.WriteLine("Failed with: {0}", readTask.Exception);
    }
}
Product Versions
.NET net5.0 net5.0-windows net6.0 net6.0-android net6.0-ios net6.0-maccatalyst net6.0-macos net6.0-tvos net6.0-windows net7.0 net7.0-android net7.0-ios net7.0-maccatalyst net7.0-macos net7.0-tvos net7.0-windows
.NET Core netcoreapp2.0 netcoreapp2.1 netcoreapp2.2 netcoreapp3.0 netcoreapp3.1
.NET Standard netstandard2.0 netstandard2.1
.NET Framework net461 net462 net463 net47 net471 net472 net48 net481
MonoAndroid monoandroid
MonoMac monomac
MonoTouch monotouch
Tizen tizen40 tizen60
Xamarin.iOS xamarinios
Xamarin.Mac xamarinmac
Xamarin.TVOS xamarintvos
Xamarin.WatchOS xamarinwatchos
Compatible target framework(s)
Additional computed target framework(s)
Learn more about Target Frameworks and .NET Standard.

NuGet packages (3)

Showing the top 3 NuGet packages that depend on Microsoft.SqlServer.XEvent.XELite:

Package Downloads
YY.DBTools.SQLServer.XEvents

Library for reading Extended Events of SQL Server

SabinIO.SqlTest

Library for the undertaking of testing against SQL Server

SabinIO.xEvent.Lib

Library for the processing of xEvent files

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2023.1.30.3 237 2/1/2023
2022.11.10.6 597 11/12/2022
2021.12.12.2 3,693 2/13/2022
2021.6.21.10 258,753 8/12/2021
2021.1.14.8 10,164 1/14/2021
2020.11.19.1 679 11/19/2020
2020.7.27.1 2,197 7/27/2020
2020.7.8.1 448 7/8/2020
2019.11.20.2 9,775 11/25/2019
2019.7.2.9 3,513 7/2/2019
2019.6.5.2 622 6/5/2019
2019.5.24.2 712 5/24/2019

Update dependency