-
-
Notifications
You must be signed in to change notification settings - Fork 496
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Updated example for Includes #564
Comments
So upon playing around a bit it looks like the above is the correct way to write the include. However it only works if i dont pass a type into the Get function to cast it from anything other than a dynamic. Looking into the code because my class does not inhearit both IDynamicMetaObjectProvider and IDictionary<string, object> the handleIncludes function just returns the results when executing. Is there a work around for casting with the nested classes or is this currently a limitation of the system, i can work around with if so, but just checking im not missing anything ovbious on how i have set up the systems |
No unfortunately the include functionality is limited by the Dynamic types for now, I didn't find an easy way to achieve that for non dynamic types at the moment. |
No worries, I can work around it with a couple of requests, was just wondering if i had missed anything ovbious. If i get time may have a play around with the source code and see if can think of an elegant solution, but cant promise anything :) Thanks for the quick response |
@Reddevildragg would you mind sharing an example please? A few of us here #308 are struggling to find an efficient way to cast it when it seems buried in dictionaries. |
Yes, please share an example, haven't solved it yet |
Quick question around is there an updated example for the Includes function?
The documentation shows the function taking 1 parameter (which i assume is a query for the table you want to connect into
However version 2.3.7 the include function appears to take a minimum of 2 parameters for relationName and query, but also optional for foreignkey, localKey and is many.
Is there an example of how to pull this together under the new parameters.
What i have tried to far is as followed:
db.Query("User").Where("User.Id", index).Include("Project",db.Query("Projects"), "ProjectId", "Id", false).Get<User>();
Which runs but then when running the "Project" field within the User Class remains as Null, not sure if i have the request wrong or if the mapping is into a class is not working as i thought it may be. For this case my User Class has the following:
Project Id gets mapped, but not project
Thanks for any help.
The text was updated successfully, but these errors were encountered: