31 lines
860 B
C#
31 lines
860 B
C#
using CoreProfiler;
|
|
using CoreProfiler.Data;
|
|
using Microsoft.Data.Sqlite;
|
|
using Microsoft.Extensions.Configuration;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Data;
|
|
using System.Linq;
|
|
using System.Text;
|
|
using System.Threading.Tasks;
|
|
|
|
namespace CoreProfilerExample.Common.Options
|
|
{
|
|
public class DatabaseOption(IConfiguration configuration) : IDatabaseOption
|
|
{
|
|
public IDbConnection SqliteConnection
|
|
{
|
|
get
|
|
{
|
|
var connectionString = configuration.GetConnectionString("SQLITE");
|
|
|
|
var dbProfiler = ProfilingSession.Current != null
|
|
? new DbProfiler(ProfilingSession.Current.Profiler)
|
|
: null;
|
|
|
|
return new ProfiledDbConnection(new SqliteConnection(connectionString), dbProfiler);
|
|
}
|
|
}
|
|
}
|
|
}
|