ā MongoDB Document Name
So I'm learning MongoDB.Driver in DotNet, and I'm figuring things out. But I got stuck on this little roadblock. So I've created dynamic methods inheriting from a base model. And somewhere here, I ended up having my documents insert under the document
T
. Now naturally, I fixing this is not hard, I simply create insert methods with the Model Type. But I do wanna know if this is possible with a generic Insert method.
tl;dr: I want to use a generic insert method to insert all my documents, but currently they all insert under the name T
. I know how this can be fixed, but am asking if this is possible with a generic insert method with the Type T
The generic method itself:
Where it is called:
23 Replies
ut currently they all insert under the name T.show where you get the collection ie how is that T even made?!
And the
CrewModel
Inherits from BaseEntitywhere/what is _DBSet
Right above the insert method
_DBSet = MongoDbContext.Database.GetCollection<T>(nameof(T));of course... you want
typeof(T).Name
Ah, I see the issue
Haha, thank you very much, let me try that real quick
I'm trying this
I'll let you know if this works
it wont work
why arent you trying wht I gave
I did, that gives me an error
There is no
Name
in the results of nameof(T)
please read
re-read
I am
Dumb
@phaseshift Thank you very much, that was it, thanks!
!close
/close
š npThanks
(you have to type it, though)
/close
It says application not responding
lol, nm. You tried!
Neither text not command, guess I'll just leave it
guys my form contain label10 !
the text of the label : Username : (Login !)
after this code the label.text dont change ! please help me guys !
Can someone please help š¦
@Jana ā” dont cross post
okay .. still can help me plss ??
stop talking about your issue in this thread
Was this issue resolved? If so, run
/close
- otherwise I will mark this as stale and this post will be archived until there is new activity.