예제 #1
0
        private Dictionary <string, string> GetParameters(ClrArray parameters)
        {
            Dictionary <string, string> parameterValues = new Dictionary <string, string>();

            for (int i = 0; i < parameters.Length; i++)
            {
                ClrObject parameter = parameters.GetObjectValue(i);
                if (parameter.Address != 0)
                {
                    string parameterName  = parameter.ReadStringField("_parameterName");
                    string parameterValue = "";
                    if (parameter.ReadObjectField("_value").Address != 0)
                    {
                        switch (parameter.ReadObjectField("_value").Type.Name)
                        {
                        case "System.Int64":
                            parameterValue = parameter.ReadField <Int64>("_value").ToString();
                            break;

                        case "System.String":
                            parameterValue = parameter.ReadObjectField("_value").AsString();
                            break;

                        case "System.Int32":
                            parameterValue = parameter.ReadField <Int32>("_value").ToString();
                            break;

                        case "System.DateTime":
                            parameterValue = parameter.ReadField <DateTime>("_value").ToString();
                            break;

                        case "System.Double":
                            parameterValue = parameter.ReadField <Double>("_value").ToString();
                            break;

                        case "System.Boolean":
                            parameterValue = parameter.ReadField <Boolean>("_value").ToString();
                            break;

                        default:
                            parameterValue = "cannot be read";
                            break;
                        }
                    }

                    if (!string.IsNullOrEmpty(parameterValue) && !string.IsNullOrEmpty(parameterName))
                    {
                        parameterValues.Add(parameterName, parameterValue);
                    }
                }
            }
            return(parameterValues);
        }
예제 #2
0
        private (string connectionString, int maxPoolSize, int minPoolSize) GetConnectionStringDetails(ClrObject connectionPool)
        {
            string connectionString;

            ClrObject poolGroup   = connectionPool.ReadObjectField("_connectionPoolGroup");
            ClrObject poolOptions = poolGroup.ReadObjectField("_connectionOptions");

            connectionString = poolOptions.ReadStringField("_usersConnectionString");

            int maxPoolSize = poolOptions.ReadField <int>("_maxPoolSize");

            int minPoolSize = poolOptions.ReadField <int>("_minPoolSize");

            return(connectionString, maxPoolSize, minPoolSize);
        }