Open isen-ng opened 5 years ago
This happens on insert as well:
Code:
var wrapped = Wrapper.Wrap(key, state);
var result = await db.InsertAsync<Wrapper<TState>>(wrapped)
Exception:
ArangoDB.Client.ArangoServerException: collection or view not found: Wrapper`1. ErrorNumber: 1203 HttpStatusCode: 404
at ArangoDB.Client.BaseResultAnalyzer.ThrowIfNeeded(BaseResult baseResult)
at ArangoDB.Client.Http.HttpCommand.RequestMergedResult[T](Object data)
at ArangoDB.Client.Collection.ArangoCollection.InsertAsync(Object document, Nullable`1 waitForSync, Action`1 baseResult)
at ArangoDB.Client.Collection.ArangoCollection`1.InsertAsync(Object document, Nullable`1 waitForSync, Action`1 baseResult)
at ArangoDB.Client.ArangoDatabase.InsertAsync[T](Object document, Nullable`1 waitForSync, Action`1 baseResult)
...
In fact, running the simplest of insertion script throws collection not found:
var result = db.Insert<State>(new State());
throws
ArangoDB.Client.ArangoServerException: collection or view not found: State. ErrorNumber: 1203 HttpStatusCode: 404
at ArangoDB.Client.BaseResultAnalyzer.ThrowIfNeeded(BaseResult baseResult)
at ArangoDB.Client.Http.HttpCommand.RequestMergedResult[T](Object data)
at ArangoDB.Client.Collection.ArangoCollection.InsertAsync(Object document, Nullable`1 waitForSync, Action`1 baseResult)
at ArangoDB.Client.Collection.ArangoCollection`1.InsertAsync(Object document, Nullable`1 waitForSync, Action`1 baseResult)
at ArangoDB.Client.ArangoDatabase.InsertAsync[T](Object document, Nullable`1 waitForSync, Action`1 baseResult)
...
Basically, I cannot get your example code on your website to run:
// insert new document and creates 'Person' collection on the fly
db.Insert<Person>(person);
this doesn't seem to be true.
It seems like auto create collection was dropped in ArangoDb 3.0, which means your documentation is still based on the old version.
If that's the case, then there needs to be a db.CreateCollection<T>
to create a the collection based on the type. This is important because all of your other APIs depend on using the type to identify the collection.
It seems like your collection name resolution is also causing problems with generics.
type.Name
will return things like Wrapped`1.
If you'd prefer, I will be able to send PRs for these issues.
@isen-ng sorry for late response, unfortunately name resolving for generic types are not handled, this should be fixed in next versions
When do you plan to support generic types?
I'm trying to upsert a document that involves a generic. The document collection has not been created yet, and I assume the collection will be automatically created like in the
Insert
method (please correct me if I'm wrong).This is the code I have:
Upon executing, I received an exception:
The generated AQL from doing
.GetQueryData().Query
is:The generated AQL is wrong as there is an extra back tick in Wrapper`1.
I'm not sure about this, but
Wrapper1
seems wrong as well, because different types for the generic will be mapped to the same collection. Assumingtypeof(TState)
is object, the collection should have beenWrapper_object
(or with any other delimiter).