-
Notifications
You must be signed in to change notification settings - Fork 5
Query logging #7
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
base: master
Are you sure you want to change the base?
Conversation
ysa23
left a comment
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please add an integration test that makes sure you get the right parameters upon query
| { | ||
| public readonly string Query; | ||
| public readonly string[] Parameters; | ||
| public readonly double MiliSeconds; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be long not double
|
|
||
| namespace OhioBox.Moranbernate.Logging | ||
| { | ||
| public static class QueryLoggingRepo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This class should be internal
| { | ||
| public static void Initialize(Assembly[] assemblies, IQueryLogger[] queryLoggers) | ||
| { | ||
| MappingRepoDictionary.InitializeAssemblies(assemblies); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Lets upgrade the major version - deprecating MappingRepoDictionary.InitializeAssemblies as public method and replace it with the initializer
| { | ||
| public class MoranbernateInitializer | ||
| { | ||
| public static void Initialize(Assembly[] assemblies, IQueryLogger[] queryLoggers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Since query loggers are optional, give the parameter a default value
| { | ||
| public class MoranbernateInitializer | ||
| { | ||
| public static void Initialize(Assembly[] assemblies, IQueryLogger[] queryLoggers) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
If you want, you can make it fluent:
new MoranbernateInitializer()
.AddAssemblies(...)
.AddLogger(...)
|
|
||
| namespace OhioBox.Moranbernate.Logging | ||
| { | ||
| public static class QueryLoggingRepo |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Rename to QueryLogger
| public interface IQueryLogger | ||
| { | ||
| void LogFailedQuery(QueryPerformanceLog queryLog, Exception exception); | ||
| void LogSuccesfulQuery(QueryPerformanceLog queryLog); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
typo!!! OMG!!! :)
| public class QueryPerformanceLog | ||
| { | ||
| public readonly string Query; | ||
| public readonly string[] Parameters; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
This should be an array of IDbParameter - so you don't need to do any work to get and also it will give more freedom to the logger to do whatever it needs
No description provided.