code examples

71 views
Skip to first unread message

Christopher Ireland

unread,
Feb 12, 2016, 1:27:35 AM2/12/16
to re-motion Users
I'm working with your excellent Remotion.Linq, but having searched through this group (for "code example"), on the general internet and in your Github repo for full code examples, I'm afraid I cannot find any. Would you please be so kind as to link to a full code example or two of how to implement Remotion.Linq?

Thank you very much for any replies, and many apologies if I've missed this question when it was answered earlier.

Michael Ketting

unread,
Feb 12, 2016, 2:12:41 AM2/12/16
to re-motion Users
Hi Christopher!

You check out the codeplex page linked from Github: https://relinq.codeplex.com/ and in particular the end-to-end sample: http://www.codeproject.com/Articles/42059/re-linq-ishing-the-Pain-Using-re-linq-to-Implement. It's a bit dated since it is based on the .net 3.5 version and APIs, but the changes are summarized here: http://www.codeproject.com/Articles/42059/re-linq-ishing-the-Pain-Using-re-linq-to-Implement?msg=5200210#xx5200210xx and http://www.codeproject.com/Articles/42059/re-linq-ishing-the-Pain-Using-re-linq-to-Implement?msg=5200210#xx5200210xx

The sample's sources are on Github: https://github.com/re-motion/Samples-ReLinq-LinqToHql-V2

Best regards, Michael

Christopher Ireland

unread,
Feb 12, 2016, 8:40:01 AM2/12/16
to re-motion Users
Many thanks Michael!

El divendres, 12 febrer de 2016 8:12:41 UTC+1, Michael Ketting va escriure:

Christopher Ireland

unread,
Feb 12, 2016, 10:14:01 AM2/12/16
to re-motion Users
Hello Michael,

I've made the changes to the NHibernate.ReLinq.Sample so it works with the Core.Net_4_5 (from the source github repo) - I would create a branch/pull request on the github repo for the changes but I don't have permissions.

I'm having difficulty updating NHibernate.ReLinq.Sample.UnitTests, however, as the IToTextConvertible (and Remotion.Diagnostics namespace) seem to be missing from the source github repo.

Thanks again,

Chris.

El divendres, 12 febrer de 2016 14:40:01 UTC+1, Christopher Ireland va escriure:

Michael Ketting

unread,
Feb 12, 2016, 10:52:05 AM2/12/16
to re-motion Users
Hi Christopher!

That's great! Many thanks :) Since you're already at it: are you doing the upgrade directly to nuget packages? For re-motion, the sample will only need Remotion.Linq after the update. The other Remotion.* assemblies are just old dependencies no longer needed with the current version of re-linq.

You can do a fork in Github to fork the repo to your own account ("Fork"-button in the right top corner of the Github source code page), then create a branch and make pull request from your branch to the main repository and I'll be happy to check it out and apply it.

Old stuff:
* SeparatedStringBuilder.Build() -> string.Join()
* Equals() and GetHashcode() -> Do you use ReSharper? You can use the default ReSharper generated equality members for those (based on the same members). We just use them to do value equality in the tests.
* IToTextConvertible -> You can drop those and switch to ReSharper generated formatting for it. It's just diagnostic output in ToString() when the equals-check in the test fails.

Best regards, Michael

Christopher Ireland

unread,
Feb 15, 2016, 10:20:32 AM2/15/16
to re-motion Users
Hi Michael,

It would be great to be able to contribute.

One thing though - I see that the latest NHibernate.dll from Nuget already has the Remotion.Linq namespaces in it, but has no reference to a separate Remotion.Linq assembly. Can I assume then that the NHibernate.ReLinq.Sample was eventually incorporated, as source code, into NHibernate.dll itself? If so it would be great to get the source to this NHiberate.dll, although I see that the nhibernate.core on Github does not actually have these Remotion.Linq source files included. Maybe I should get in touch with the NHibernate team.

Thank you,

Chris. 

El divendres, 12 febrer de 2016 16:52:05 UTC+1, Michael Ketting va escriure:
Hi Christopher!

Michael Ketting

unread,
Feb 16, 2016, 2:05:08 AM2/16/16
to re-motion Users
Hi Chris!

Regarding NHibernate, the anser is 'sorta'. Our sample generates an actual HQL-string, which is then given to NHibernate to parse. The guys in NHibernate took it from there and actually integrated re-linq's frontend to directly build their HQL-AST from re-linq's query model, which is a much more native approach to the problem. You can also tell that they have much more code in their own Linq-namespace than the sample. They also do an IL-merge of the Remotion.Linq assembly into the main NHibernate assembly and change the namespaces to internal. This means you can just use the current NHibernate assembly with the sample and the two bits won't touch.

Best regards, Michael
Reply all
Reply to author
Forward
0 new messages