The importance of trace types must be chosen not because of where the trace is in code, but because the traced message is more or less important. Example:
Trace a "Start" event when beginning a method, which should represent a single logical operation or a pipeline, along with a string representation of the parameter values passed in to the method.
Use start type when you start a logical operation. This doesn't mean that the start trace must be at the beginning of a method, nor does it mean that a method must have a start trace.
This being said, in most cases, a logical operation will actually start at the beginning of the method. Otherwise, you should ask yourself if the code is refactored correctly.
Tracing parameters may also be a bad idea. You have to think what to trace, case by case. For example it is really bad to trace parameters of a method void Authenticate(string userName, string plainPassword)
.
Trace an "Information" event when inserting an item into the database.
It depends. Some items must be traced, but not every item.
- For example imagine you are actually inserting a log item into your database. Would you trace logs? And then log traces? And then trace the logging of the trace?
- Another example: you're inserting a sensitive data. This requires auditing. Since you audited the insertion, why tracing it?
Trace an "Information" event when taking one path or another in an important if/else statement.
Again, it depends.
Trace a "Critical" or "Error" in a catch block depending on weather this is a recoverable error.
The action taken after a non-recoverable error can be more than tracing. For example server-side, you would like to store the exception in the database for further analysis. Also, some exceptions are less important than others, and does not require tracing.
Trace a "Stop" event when finishing the execution of the method.
See the first point.
please clarify when best to trace Verbose and Warning event types.
Verbose:
Verbose is used to trace what you need to trace when something goes really wrong. It means that in most cases, you will disable the tracing of verbose messages, but sometimes, you have to debug some parts of your code to understand why something fails on an edge case.
You usually have lots of verbose messages which let you understand really well the application flow. It also means that those messages must be disabled most of the time because:
- otherwise, the log will grow really fast,
- you don't need them most of the time,
- they may contain sensitive data about the application flow.
Think about verbose as a tool you have to use when you don't have an access to the debugger.
Warning:
Warning type trace is used when something wrong and important happens, but is not too crucial to be treated as an error. For example low RAM may emit a warning, but there is no reason to trace an error, since your application can continue, even if it will be slower than usual.
Examples:
Example 1: the application failed to open the file the user requested to open. The file exists and is not in use, permissions are set correctly, but something blocks the opening of a file. In this case, you will trace an error, since your application cannot manage this case and continue to work as expected by the user (i.e. actually read the file).
Example 2: after inspection of the error in the first example, you find that the error is caused by the fact that the file path is longer than 259 characters. So you refactor your code to catch PathTooLongException
. When, the next time, the user tries to open the same file, the new version of the application shows a message explaining that the file is too long and must be moved to another folder to shorten the full path in order to open this file in this application. You also trace a message.
Example 3: your application spent twenty seconds opening and parsing a small file while most files take ten to one hundred milliseconds to open and parse. You trace a warning with relevant info: the type of disk where the file actually is, the file system, the size of the file, the exact time spent, the time the computer was on, etc. When the user complains that it takes twenty seconds to open the file, you take the trace to find what happens. You find for example that it takes so long to load the files from a network share when the computer have just started. You explain to the user that the delay is due to the network and is not related to your application.
Example 4: the opened file is displayed incorrectly. You enable verbose trace where you actually see how the data is loaded from file and then parsed, step by step.
This is going to be a large and very involved project. I've been responsible for migrating Access databases to .NET many times, but never on this scale. I agree that a gradual approach will probably be the most realistic. Trying to take on everything in one shot is an easy way to fail.
As in other answers, the first and most important step will be to move everything to SQL Server. While doing this, document the database if this hasn't already been done, and identify areas for refactoring if they exist. Access databases that grow to meet evolving needs often have data models that can be improved upon when looking at the big picture.
Next, identify modules of the application that are "self contained". Because this is a do-everything database, there will probably be modules of it that are nearly completely disjoint from each other. After having these disjoint pieces, identify one of the smaller modules that has the most to gain from being updated, and take it on first.
While migrating to .NET, don't just do a simple 1 to 1 copy of the application. Gather input from users to identify pain points with the current application. You want your first migration unit to be a huge success to gain the complete buy in from everyone else.
After you have the first unit done, look at what happened in terms of challenges, difficulties, etc, and use this moving forward.
One thing that I would strongly discourage would be to implement partially working modules (ex: "we migrated the CRM, but features X,Y,Z are not in the new system yet"). This will cause users to quickly become frustrated from having an incomplete system when the old one to them was "perfectly fine". This kind of development may work fine for other domains, but not in businesses where users see "nothing wrong" with the old Access monolith and don't understand the migration needs.
Best Answer
In my firm we are using the EF. It's a nice ORM, suitable for our small project. In reality people are using EF or NHibernate. Both frameworks are good. EF has a great MS support and you can find great tools bundled with Visual Studio. NHibernate is considered better than EF but there is a bigger "learning curve" so you will spend more time adopting it.
I think that, if you are on the Ado.Net "classic" try the EF. Create a simple project and replace some of the DAL methods. Check how it works and how you can manage/modify the code. Compare it with the simple "SqlDataReader" methods and decide which is better. Remember that every technology shift needs some time for adoption so you have to calculate if this change will be beneficial for your company in the long run.