public static SkyApmExtensions AddEntityFrameworkCore(this SkyApmExtensions extensions, Action <DatabaseProviderBuilder> optionAction)
        {
            if (extensions == null)
            {
                throw new ArgumentNullException(nameof(extensions));
            }

            extensions.Services.AddSingleton <ITracingDiagnosticProcessor, EntityFrameworkCoreTracingDiagnosticProcessor>();
            extensions.Services.AddSingleton <IEntityFrameworkCoreSegmentContextFactory, EntityFrameworkCoreSegmentContextFactory>();

            if (optionAction != null)
            {
                var databaseProviderBuilder = new DatabaseProviderBuilder(extensions.Services);
                optionAction(databaseProviderBuilder);
            }

            return(extensions);
        }
示例#2
0
 public static DatabaseProviderBuilder AddSqlite(this DatabaseProviderBuilder builder)
 {
     builder.Services.AddSingleton <IEntityFrameworkCoreSpanMetadataProvider, SqliteEntityFrameworkCoreSpanMetadataProvider>();
     return(builder);
 }