Skip to content

Question about OracleDynamicParameters usage (is it possible to use NClob in anonumous param object?) #72

@leqwasd

Description

@leqwasd

Not an actual issue, just a question -

I had a query like this:

public async Task Update(string description, int id) {
    var param = new {
        description,
        id
    };
    await db.ExecuteAsync("UPDATE myTable SET description = :description where id = :id", param);
}

DB type of description is nclob, it worked fine until I hit the point, where description length > 4000.

So I changed it like this:

public async Task Update(string description, int id) {
    var param = new OracleDynamicParameters();
    param.Add("description", description,OracleMappingType.NClob);
    param.Add("id", id);
    await db.ExecuteAsync("UPDATE myTable SET description = :description where id = :id", param);
}

And this works.
Question: If I have a situation, where I need to pass an argument as a NClob - is this the only way to achieve it?
Or is there a way to set the type of an argument using anonymous object like

    var param = new {
        description = new OracleParam(description, OracleMappingType.NClob), // Something like this, I just imagined this line here
        id
    };
    ...

It would reduce the amount of lines that I would need to refactor.

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions