using linqpad with dynamics - d365ug
TRANSCRIPT
Using LINQPad with Dynamics
Presented by: Ben Walker, University of Oxford
About Me•Technical Team Lead
•20 years in IT, working with CRM since 2011
•Lead a small team developing applications for the University.
• @bwmodular
• Blog: http://blogs.it.ox.ac.uk/benwalker/
Agenda• What is LINQPad?
• Connecting to CRM with LINQPad
• Using LINQPad for:
• Prototyping
• Learning
• Debugging
• Testing
• Support
• Raffle
What is LINQPad
LINQPad is a ‘scratchpad’ for .Net Developers.
It’s a lightweight editor which allows you to write, execute and
debug ‘fragments’ of code, from individual expressions to
complete programs.
Because sometimes all you need is a script, not a whole Visual
Studio project…!
Let’s see it in action!
https://www.linqpad.net/
Demo
LINQPad as a learning tool
• Look through the Sample Libraries
• Great for Exploring Unfamiliar API’s
• Create a common code library to share with colleagues
• Ctrl + Shift + F to search all samples and scripts
NUGET integration
• Full Nuget integration (with Developer and Premium editions)
• Nuget libraries are cached – only need to get them once- then they are available to all other scripts
LINQPad Drivers
• Many drivers exist for different datasources.
• We’ll see CRM in a minute, but here are some others:http://www.linqpad.net/richclient/datacontextdrivers.aspx
Connecting LINQPad to CRM
• 2 Options• CRM LINQPad Driver
• Manual Connection
• Manual connections can use password manager
CRM Connections – quick switch between orgs
• http://blogs.it.ox.ac.uk/benwalker
• http://blogs.it.ox.ac.uk/benwalker/2017/04/20/connecting-linqpad-to-dynamics-crm-using-the-dynamics-crm-linqpad-driver/
• http://blogs.it.ox.ac.uk/benwalker/2017/04/20/connecting-linqpad-to-dynamics-crm-using-a-manually-created-connection/
Connecting LINQPad to CRMConnect using Driver Connect Manually
Quick switch between
environments
Can connect to more than one organisation
simultaneously – compare data in different
organisations
Persistent connection Impersonation of other users
Early-bound coding OOB Workaround for duplicate early-bound class name
issue *
Explore CRM Entities Driver may not work with Dynamics 2016+ **
Easy querying using LINQ
Even Less Code!
Mark Connections as Production
• * https://github.com/kenakamu/CRMLinqPadDriverWebAPI/issues/1
• ** https://crmlinqpadwebapi.codeplex.com/
How easy is….?
Creating Records
Querying Data
Executing any API call
Debugging
Impersonation
Execute code as another user
Great for support
Great for testing security roles and sharing
http://blogs.it.ox.ac.uk/benwalker/2017/04/24/using-impersonation-in-dynamics-crm/
Snippets
All Visual Studio snippets available…
…but you can also create your own
Common CRM Tasks available with a couple ofkeystrokes
http://blogs.it.ox.ac.uk/benwalker/2017/04/21/creating-snippets-for-use-with-linqpad/
Extensions
• Objects and Methods common to all queries
• Another way to share common code and reduce ‘clutter’ in scripts
Testing
Creating Test Data
Testing Plugins
Testing Security – test security roles and sharing implementations – you cannot do this with Unit Tests!
SupportScripting simple tasks
Removing Message Processing Steps – 1 script, vs 19 mouse clicks
Querying data (especially N:N)
Comparing data across environments
Creating users from spreadsheets
Synching data across environments
Metadata updates – example of accommodation attributes for ADSS
Etc…….
File-sharing and source control
No native integration with Source Control, but….
…you can easily integrate with Source Control
Change the folder locations
File-sharing and source control
File-sharing and source control
See my blog for an example of integration with VSTS:
http://blogs.it.ox.ac.uk/benwalker/2017/04/21/integrating-linqpad-scripts-into-source-control/
LINQPad also features ‘instant share’ – gives you a URL to share any script
LPRun & LinqPadless
• LPRun
Installed with LINQPad – run any .LINQ script from command line
• LinqPadless
• https://github.com/linqpadless/LinqPadless
Turn any LINQPad script into an exe (or csx)
Licencing
Four editions:
• Free
• Pro
• Developer
• Premium
Licencing
Licencing
Useful ResourcesLINQPad forums http://forum.linqpad.net/
@linqpad
My Blog: http://blogs.it.ox.ac.uk/benwalker/category/linqpad/
https://www.danclarke.com/linqpad-tips-and-tricks see Utilmethods
http://www.devcurry.com/2011/08/50-linq-examples-now-in-linqpad.html
Conclusion
• Amazing Productivity Enhancer
• Incredible Timesaver
• Great for Prototyping
• Great for CRM developers, but not just for CRM
• Perfectly hits the sweet spot in terms of features vs ease and speed of use
• I could not do without it!
Questions?
RAFFLEPrize kindly donated by Joseph Albahari