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

Profiler is getting command before DbInterceptor #643

Open
jricardogarcia opened this issue Feb 15, 2023 · 2 comments
Open

Profiler is getting command before DbInterceptor #643

jricardogarcia opened this issue Feb 15, 2023 · 2 comments

Comments

@jricardogarcia
Copy link

Before in profiler EF6, the change made by DbInterceptor was captured correctly, now in the version of EF Core, the profiler command is the original one, before going through DbInterceptor.

Query from MiniProfiler:
`DECLARE @__CodigoIdiomaDoUsuario_0 int = 1,
@__id_1 int = 1;

SELECT [t0].[CodigoMatrizCurricularDisciplina], [t0].[CodigoMatrizCurricular], [t0].[CodigoDisciplina], [t0].[Classificacao], [t0].[CodigoMatrizCurricularModulo], [t0].[DisciplinaDescricaoCompleta], [t0].[ModuloOrdem], [t0].[DescricaoModulo], [t0].[CodigoMatrizCurricularGrupoDisciplina], [t0].[CodigoMatrizCurricularGrupoFormacao], [t0].[CodigoDisciplinaComplemento], [t0].[CodigoIdentificacao], [t0].[LocalComplementoDisciplina], [t0].[CargaHoraria], [t0].[CreditoAcademico], [t0].[TipoAnaliseEquivalencia], [t0].[TipoDisciplina], [t0].[DisponibilizaTurmaEquivalenteMatriculaMatriz], [t0].[QuantidadeCreditosConcluidos], [t0].[PercentualLimiteCurso], [t0].[CargaHorariaExtensionista], [t0].[ValidadeAprovacaoDisciplinaDias]
FROM (
SELECT DISTINCT [s0].[CODIGOMATRCURRDISCIPLI] AS [CodigoMatrizCurricularDisciplina], [s].[CODIGOMATRIZCURRICULAR] AS [CodigoMatrizCurricular], [s0].[CODIGODISCIPLINA] AS [CodigoDisciplina], [s0].[E_CLASSIFICACAO] AS [Classificacao], [s0].[CODIGOMATRCURRMODULO] AS [CodigoMatrizCurricularModulo], [v0].[DESCRICAOIDENTIFICACAO] AS [DisciplinaDescricaoCompleta], [s1].[ORDEM] AS [ModuloOrdem], [s1].[DESCRICAO] AS [DescricaoModulo], [s0].[CODIGOMATRCURRGRUPODISCIPLINA] AS [CodigoMatrizCurricularGrupoDisciplina], [s0].[CODIGOMATRCURRGRUPOFORMACAO] AS [CodigoMatrizCurricularGrupoFormacao], [s0].[CODIGODISCIPLINACOMPLE] AS [CodigoDisciplinaComplemento], [t].[CODIGOIDENTIFICACAO] AS [CodigoIdentificacao], [s4].[E_LOCALCOMPLEMENTODISCIPLINA] AS [LocalComplementoDisciplina], CASE
WHEN [s4].[E_LOCALCOMPLEMENTODISCIPLINA] = 1 THEN [s6].[CARGAHORARIA]
ELSE [s5].[CARGAHORARIA]
END AS [CargaHoraria], CASE
WHEN [s4].[E_LOCALCOMPLEMENTODISCIPLINA] = 1 THEN [s6].[CREDITOACADEMICO]
ELSE [s5].[CREDITOACADEMICO]
END AS [CreditoAcademico], [s0].[E_TIPOANALISEEQUIVALENCIA] AS [TipoAnaliseEquivalencia], COALESCE([v0].[E_TIPODISCIPLINA], 3) AS [TipoDisciplina], [s0].[DISPONIBTURMAEQUIVMATRICMATRIZ] AS [DisponibilizaTurmaEquivalenteMatriculaMatriz], [s0].[QTDCREDITOSCONCLUIDO] AS [QuantidadeCreditosConcluidos], [s0].[PERCENTUALLIMITECURSO] AS [PercentualLimiteCurso], [s0].[CARGAHORARIAEXTENSIONISTA] AS [CargaHorariaExtensionista], [s0].[VALIDADEAPROVACAODISCIPLINADIAS] AS [ValidadeAprovacaoDisciplinaDias]
FROM [GVDASA].[SEC_MATRIZCURRICULAR] AS [s]
INNER JOIN [GVDASA].[SEC_MATRCURRDISCIPLI] AS [s0] ON [s].[CODIGOMATRIZCURRICULAR] = [s0].[CODIGOMATRIZCURRICULAR]
INNER JOIN [GVDASA].[SEC_MATRCURRMODULO] AS [s1] ON [s].[CODIGOMATRIZCURRICULAR] = [s1].[CODIGOMATRIZCURRICULAR]
INNER JOIN [GVDASA].[VW_SEC_MATRCURRDISCIPLI] AS [v] ON [s0].[CODIGOMATRCURRDISCIPLI] = [v].[CODIGOMATRCURRDISCIPLI]
INNER JOIN (
SELECT [s2].[CODIGODISCIPLINA], [s2].[CODIGOIDENTIFICACAO], [s3].[CODIGODISCIPLINACOMPLE], [s3].[CODIGONIVELENSINO]
FROM [GVDASA].[SEC_DISCIPLINA] AS [s2]
INNER JOIN [GVDASA].[SEC_DISCIPLINANORMAL] AS [s3] ON [s2].[CODIGODISCIPLINA] = [s3].[CODIGODISCIPLINA]
) AS [t] ON [s0].[CODIGODISCIPLINA] = [t].[CODIGODISCIPLINA]
INNER JOIN [GVDASA].[VW_SEC_DISCIPLINA] AS [v0] ON [t].[CODIGODISCIPLINA] = [v0].[CODIGODISCIPLINA] AND @__CodigoIdiomaDoUsuario_0 = [v0].[CODIGOIDIOMA]
INNER JOIN [GVDASA].[SEC_NIVELENSINO] AS [s4] ON [t].[CODIGONIVELENSINO] = [s4].[CODIGONIVELENSINO]
LEFT JOIN [GVDASA].[SEC_DISCIPLINACOMPLE] AS [s5] ON [s0].[CODIGODISCIPLINACOMPLE] = [s5].[CODIGODISCIPLINACOMPLE]
LEFT JOIN [GVDASA].[SEC_DISCIPLINACOMPLE] AS [s6] ON [t].[CODIGODISCIPLINACOMPLE] = [s6].[CODIGODISCIPLINACOMPLE]
WHERE [s].[CODIGOMATRIZCURRICULAR] = @__id_1 AND [s1].[CODIGOMATRCURRMODULO] = [s0].[CODIGOMATRCURRMODULO]
) AS [t0]
ORDER BY [t0].[ModuloOrdem], [t0].[DisciplinaDescricaoCompleta];`

Query from SQL Server Profiler
`DECLARE @__CodigoIdiomaDoUsuario_0 int = 1,
@__id_1 int = 1;

SELECT [t0].[CodigoMatrizCurricularDisciplina], [t0].[CodigoMatrizCurricular], [t0].[CodigoDisciplina], [t0].[Classificacao], [t0].[CodigoMatrizCurricularModulo], [t0].[DisciplinaDescricaoCompleta], [t0].[ModuloOrdem], [t0].[DescricaoModulo], [t0].[CodigoMatrizCurricularGrupoDisciplina], [t0].[CodigoMatrizCurricularGrupoFormacao], [t0].[CodigoDisciplinaComplemento], [t0].[CodigoIdentificacao], [t0].[LocalComplementoDisciplina], [t0].[CargaHoraria], [t0].[CreditoAcademico], [t0].[TipoAnaliseEquivalencia], [t0].[TipoDisciplina], [t0].[DisponibilizaTurmaEquivalenteMatriculaMatriz], [t0].[QuantidadeCreditosConcluidos], [t0].[PercentualLimiteCurso], [t0].[CargaHorariaExtensionista], [t0].[ValidadeAprovacaoDisciplinaDias]
FROM (
SELECT DISTINCT [s0].[CODIGOMATRCURRDISCIPLI] AS [CodigoMatrizCurricularDisciplina], [s].[CODIGOMATRIZCURRICULAR] AS [CodigoMatrizCurricular], [s0].[CODIGODISCIPLINA] AS [CodigoDisciplina], [s0].[E_CLASSIFICACAO] AS [Classificacao], [s0].[CODIGOMATRCURRMODULO] AS [CodigoMatrizCurricularModulo], [v0].[DESCRICAOIDENTIFICACAO] AS [DisciplinaDescricaoCompleta], [s1].[ORDEM] AS [ModuloOrdem], [s1].[DESCRICAO] AS [DescricaoModulo], [s0].[CODIGOMATRCURRGRUPODISCIPLINA] AS [CodigoMatrizCurricularGrupoDisciplina], [s0].[CODIGOMATRCURRGRUPOFORMACAO] AS [CodigoMatrizCurricularGrupoFormacao], [s0].[CODIGODISCIPLINACOMPLE] AS [CodigoDisciplinaComplemento], [t].[CODIGOIDENTIFICACAO] AS [CodigoIdentificacao], [s4].[E_LOCALCOMPLEMENTODISCIPLINA] AS [LocalComplementoDisciplina], CASE
WHEN [s4].[E_LOCALCOMPLEMENTODISCIPLINA] = 1 THEN [s6].[CARGAHORARIA]
ELSE [s5].[CARGAHORARIA]
END AS [CargaHoraria], CASE
WHEN [s4].[E_LOCALCOMPLEMENTODISCIPLINA] = 1 THEN [s6].[CREDITOACADEMICO]
ELSE [s5].[CREDITOACADEMICO]
END AS [CreditoAcademico], [s0].[E_TIPOANALISEEQUIVALENCIA] AS [TipoAnaliseEquivalencia], COALESCE([v0].[E_TIPODISCIPLINA], 3) AS [TipoDisciplina], [s0].[DISPONIBTURMAEQUIVMATRICMATRIZ] AS [DisponibilizaTurmaEquivalenteMatriculaMatriz], [s0].[QTDCREDITOSCONCLUIDO] AS [QuantidadeCreditosConcluidos], [s0].[PERCENTUALLIMITECURSO] AS [PercentualLimiteCurso], [s0].[CARGAHORARIAEXTENSIONISTA] AS [CargaHorariaExtensionista], [s0].[VALIDADEAPROVACAODISCIPLINADIAS] AS [ValidadeAprovacaoDisciplinaDias]
FROM [GVDASA].[SEC_MATRIZCURRICULAR] AS [s]
INNER JOIN [GVDASA].[SEC_MATRCURRDISCIPLI] AS [s0] WITH (FORCESEEK ([IX_SEC_MATRCURRDISCIPLI_MCDDSP] ([CODIGOMATRCURRDISCIPLI]))) ON [s].[CODIGOMATRIZCURRICULAR] = [s0].[CODIGOMATRIZCURRICULAR]
INNER JOIN [GVDASA].[SEC_MATRCURRMODULO] AS [s1] ON [s].[CODIGOMATRIZCURRICULAR] = [s1].[CODIGOMATRIZCURRICULAR]
INNER JOIN [GVDASA].[VW_SEC_MATRCURRDISCIPLI] AS [v] ON [s0].[CODIGOMATRCURRDISCIPLI] = [v].[CODIGOMATRCURRDISCIPLI]
INNER JOIN (
SELECT [s2].[CODIGODISCIPLINA], [s2].[CODIGOIDENTIFICACAO], [s3].[CODIGODISCIPLINACOMPLE], [s3].[CODIGONIVELENSINO]
FROM [GVDASA].[SEC_DISCIPLINA] AS [s2]
INNER JOIN [GVDASA].[SEC_DISCIPLINANORMAL] AS [s3] ON [s2].[CODIGODISCIPLINA] = [s3].[CODIGODISCIPLINA]
) AS [t] ON [s0].[CODIGODISCIPLINA] = [t].[CODIGODISCIPLINA]
INNER JOIN [GVDASA].[VW_SEC_DISCIPLINA] AS [v0] ON [t].[CODIGODISCIPLINA] = [v0].[CODIGODISCIPLINA] AND @__CodigoIdiomaDoUsuario_0 = [v0].[CODIGOIDIOMA]
INNER JOIN [GVDASA].[SEC_NIVELENSINO] AS [s4] ON [t].[CODIGONIVELENSINO] = [s4].[CODIGONIVELENSINO]
LEFT JOIN [GVDASA].[SEC_DISCIPLINACOMPLE] AS [s5] ON [s0].[CODIGODISCIPLINACOMPLE] = [s5].[CODIGODISCIPLINACOMPLE]
LEFT JOIN [GVDASA].[SEC_DISCIPLINACOMPLE] AS [s6] ON [t].[CODIGODISCIPLINACOMPLE] = [s6].[CODIGODISCIPLINACOMPLE]
WHERE [s].[CODIGOMATRIZCURRICULAR] = @__id_1 AND [s1].[CODIGOMATRCURRMODULO] = [s0].[CODIGOMATRCURRMODULO]
) AS [t0]
ORDER BY [t0].[ModuloOrdem], [t0].[DisciplinaDescricaoCompleta]`

The part in bold and italics is what was changed by DbInterceptor.

@jricardogarcia
Copy link
Author

To complement the information, I noticed that the DbInterceptor is being executed twice, the second time being by the miniprofiler.
Is this the new behavior?

@NickCraver
Copy link
Member

@ajcvickers I'm not up to date on latest here - any advice/pointers on where we should hook in with EF Core to get post-interceptor most efficiently?

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

2 participants