Skip to content

Use additional information about parameter values on DbParameter creation #57

Open
@alex-kulakov

Description

@alex-kulakov

Some additional information would be helpful on DbParameter creation. For instance, precision and scale for decimals or length for strings.

For example, for the following model

     [HierarchyRoot]
     public class Author : Entity
     {
       [Key]
       [Field]
       public int Id { get; private set; }

       [Field(Precision = 9, Scale = 3)]
       public decimal Test { get; set; }

       public Author(Session session): base(session) 
       {
       }
     }

setting the precision and scale from field instead of actual value of Test on persist operations will be beneficial for query plan cache. As an example, updating the Test field value. We always have the same query except for the parameter's value. But due to different precision and scale some queries are treated as "different"(but they are not).

We have ParameterBinding and it may be a great way to pass this additional info.

For persist operations (INSERT, UPDATE, DELETE) such bindings are created in PersistRequestBuilder and all needed information about fields and columns is available there.

For queries it will be more complicated. Need to investigate what cases can pass information about parameters.

We will be able to use the info in CommandFactory to initialize DbParameter properties, and in case of no additional information we let RDBMS driver decide (current behavior).

Metadata

Metadata

Assignees

No one assigned

    Labels

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions