This is the official open channel for RepoDb (.NET) Hybrid ORM Library. This channel will allow the community of .NET to have a fast and efficient way of communication in relation to RepoDb, useful to address the community needs (i.e.: Questions, Issues, Recommendations, Proposals, etc).
mikependon on repodb-fixes-1052
mikependon on master
Initial enhancement for adding … 1052 Unit Tests updates. #1052 More updates to fix the f… and 4 more (compare)
mikependon on repodb-fixes-1052
#1052 Actual logic that passes … (compare)
Exception data:
Severity: ERROR
SqlState: 22P02
MessageText: invalid input value for enum location_category: "Suburb"
File: enum.c
Line: 133
Routine: enum_in
--- End of inner exception stack trace ---
at System.Threading.Tasks.Task.ThrowIfExceptional(Boolean includeTaskCanceledExceptions)
at System.Threading.Tasks.Task`1.GetResultCore(Boolean waitCompletionNotification)
at System.Threading.Tasks.Task`1.get_Result()
at Domain.Pls.FsUtil.Uti
type location_category =
| Suburb = 0
| Area = 1
| Region = 2
type rtree_state =
{
[<NpgsqlDbType(NpgsqlDbType.Unknown)>]
location_category: location_category
[<NpgsqlDbType(NpgsqlDbType.Jsonb)>]
data: string }
First of all, kudos to you @mikependon! RepoDB is amazing and feels like the sweet spot between ado.net/dapper and EF. I am trying to bring it to production. I have observed a funky, non-blocking behavior with the Map
attribute and was wondering if it is expected before submitting a new issue.
Experimentation
Value
, which is related to a DB column named "value_raw", with a Map("value_raw")
attribute.SmoothedValue
, which is related to a DB column named "value", with a Map("value")
attribute.Query
method from BaseRepository
to retrieve persisted entities.Observations
Value
. The Map("value_raw")
attribute behaves as expected.SmoothedValue
. The Map("value")
attribute does NOT behave as expected.SmoothedValue
actually matches the property Value
. Interpretation
It looks like the Map("value")
attribute does not pick up data from the DB column named "value". Instead it picks up data from the Value
property of the poco.
Workaround
Rename the property Value
to ValueRaw
.
Hey could do with some advice.
So someone has written a raw SQL block which does lots of stuff, then they run it through ExecuteQueryAsync(theSqlString);
now it all works fine for them, but I need to come along and add paging to it, and I was hoping I could just leave that all as is and just tack onto the end ExecuteQueryAsync(theSqlString).Skip(n).Take(n);
however when I do that it blows up telling me Only dynamic object is supported in the 'where' expression.
So is this scenario doable or should I fudge the limit into the SQL block?
QueryAsync
with a QueryGroup
then Skip
and Take
etc
top
field which I assume lets me at least specify how many records to return, but cant see an offset field
OrderField
objects? as in some cases I wont know the best field to order by so would just like to default it, but seems like for Batches I need to provide an order field
var products = connection.QueryAll<Product>().Join<ProductCategory>("CategoryId")
versusvar products = connection.ExecuteQuery<Product>("SELECT p.*, pc.Name FROM [dbo].[Product] p INNER JOIN [dbo].[ProductCategories] pc ON p.CategoryId = pc.Id;")
I have the schema
create table draft_item
(
topic text not null,
id text not null,
timestamp timestamptz not null,
sequence bigint not null,
payload jsonb not null,
errors text[] not null,
constraint pk_draft_items primary key (id, topic)
);
And I am trying to update the errors column using the following.
let sql =
"""
update draft_item
set errors = @errors
where topic = @topic and id = @id
"""
task {
use! conn = connBuilder ()
let param =
{| topic = topic
id = id
errors = errors |}
let! _ = conn.ExecuteNonQueryAsync(sql, param = param)
return ()
However I get column "errors" is of type text[] but expression is of type text
instead.
@Swoorup is it an array of string you passed on the 'errors' parameter?
full method
let updateErrors (connBuilder: DbConnBuilder) (Topic topic) (MsgId id) (errors: string list) =
let errors = Array.ofList errors
let sql =
"""
update draft_item
set errors = @errors
where topic = @topic and id = @id
"""
task {
use! conn = connBuilder ()
let param =
{| topic = topic
id = id
errors = errors |}
let! _ = conn.ExecuteNonQueryAsync(sql, param = param)
return ()