Skip to content
IzayoiJiichan edited this page Aug 31, 2024 · 19 revisions

Query Builder

  • What should I do about SQL differences due to differences in RDB?

Please specify RdbKind in QueryOption.

  • The DbType of the value is not what is expected.

If the method you are adding values ​​to has a dbType argument, specify the correct DbType there.
This is especially necessary if you want to set the value to null.

  • I want to prevent a specified value from being bound to the parameter.

If the method you are adding a value to has isExpression argument, set it to true.

DbDataMapper

  • Mapping fails.

    • Do the table name ([Table] attribute or class name) match?
    • If the database has a schema, do the schema names match?
    • Do the column name ([Column] attribute or property name) match?
    • Is the property public?
    • Does the property have both getter and setter?
    • Make sure that the data type of the database column matches the data type of the mapping class property.
    • Does the data size match?
    • Does unsigned match?
    • In case of enum, also check the data type of the enum.
    • Do you assign the [KEY] attribute to the primary key?
    • Has the [NotMapped] attribute been assigned? (If it is attached, it will be excluded from mapping.)
  • I want to improve processing speed.

Reuse the DbDataMapper object.

DbCommandAdapter

  • I want to investigate what is wrong and why.

Check the CommandText and DbParameterCollection properties of the DbCommand.
In this case, setting the QueryOption's EnableFormat property to true will make the query easier to read.

  • I can't get the id when I insert.

The InsertReturnAsync method can only be used if id is auto increment.

To insert a Guid, use the InsertAsync method.

Other

  • I want to use it easily.

Define a class that inherits from DbRepositoryBase and use it.

See example

  • Can it be used with other libraries?

Can be used together.
It does not extend or override the original DbConnection, DbCommand or DbDataReader classes, so it is clean and can be used in conjunction with other libraries.