/// <summary> /// Get the parameter generator method for a command and the type used for the parameter. /// </summary> /// <param name="command">The command to analyze.</param> /// <param name="type">The type of the parameter.</param> /// <returns>The command generator.</returns> public static Action <IDbCommand, object> GetOutputParameterConverter(IDbCommand command, Type type) { QueryIdentity identity = new QueryIdentity(command, type); // try to get the deserializer. if not found, create one. return(_deserializers.GetOrAdd(identity, key => CreateClassOutputParameterConverter(command, type))); }
/// <summary> /// Get the parameter generator method for a command and the type used for the parameter. /// </summary> /// <param name="command">The command to analyze.</param> /// <param name="type">The type of the parameter.</param> /// <returns>The command generator.</returns> public static Action <IDbCommand, object> GetInputParameterGenerator(IDbCommand command, Type type) { QueryIdentity identity = new QueryIdentity(command, type); // try to get the deserializer. if not found, create one. return(_serializers.GetOrAdd( identity, key => { if (type.IsSubclassOf(typeof(DynamicObject))) { return CreateDynamicInputParameterGenerator(command); } else if (type == typeof(Dictionary <string, object>)) { return CreateDynamicInputParameterGenerator(command); } else { return CreateClassInputParameterGenerator(command, type); } })); }