Explicitly casting enums on setters

Would it be possible to have the enum setter methods explicity do a cast (in MiniProfiler.cs and SqlTiming.cs)? MySql is being a nerd and has difficulties casting from tinyint to Enum.

I’m assuming it would go something like this:

private ProfileLevel _level;
/// <summary>
/// Allows filtering of <see cref="Timing"/> steps based on what <see cref="ProfileLevel"/> 
/// the steps are created with.
/// </summary>
[DataMember(Order = 5)]
public ProfileLevel Level
{
    get
    {
        return _level;
    }
    set
    {
        _level = (ProfileLevel)((int)value);
    }
}

This would apply to SqlTimings.ExecuteType as well.

Currently I’m using Dapper to pull the data from MySql, and I’m having to map each property by hand in order to handle this casting issue.

what if we added a private ProfileLevelRaw to set and get this (shadow), it would appease Dapper / MySql

If one could be added for SqlTimings.ExecuteType as well I’d fly to where you live an give you a hug.

Update nuget with this modification and I’ll purchase you a six-pack of your favorite beverage :smiley: