Microsoft Dynamics CRM Query - T4 Template for 2013

Jul 4, 2015 at 4:20 AM
We are upgrading the code from CRM 4.0 to 2013, we need to generate the same files leveraging LINQ to SQL and the MS-CRM 2013 API to give a MS-CRM CRUD data access solution. Can you please point us to similar tool that can help us generate the code in similar manner.

Thanks

Pinku Kumar
Coordinator
Jul 4, 2015 at 5:28 AM
Hi Pinku

There isn't anything that I know of. You could port it to CRM 2013, the API 's are similar but there are datatype changes, with some changes this is totally possible.


If you don't need the full flexibility of TSQL, you could use Linq to CRM out of the SDK, but you would need to rewrite your Linq statements and related code.

Cheers

Matt
Jul 4, 2015 at 10:55 AM
Edited Jul 4, 2015 at 11:03 AM
Hi Matt,

Thank you for your reply.

Can you please guide me on how below files were generated in 4.0? as i can see in the comment
// <auto-generated>
// This code was generated by a tool.
//
// Changes to this file may cause incorrect behavior and will be lost if
// the code is regenerated.
// </auto-generated>

I want these files for CRM 2013/CRM 2015.
CrmEntities.Crm.part.cs
CrmEntities.List.shared.cs
CrmEntities.L2SQL.part.cs

Do i need to use CrmSvcUtil.exe or some existing files needs modification in L2S2CRM.ttinclude or CrmEntities.tt.

Regards,
Pinku Kumar
Coordinator
Jul 4, 2015 at 2:12 PM
Files ending in tt are t4 templates that work in VS. You right click then and choose "run custom tool" to generate files. The templates contain code that calls the Linq to SQL exe to generate linq to sql code from the CRM filtered views, then it generates code so that creates, updates use crm to put data back in to crm. So you will need to change the code relating to updating CRM objects and the sql datatype to crm datatype mapping.

Sorry I'm away on leave and don't have pc with me, so this is challenging to do on phone.
Oct 6, 2015 at 11:32 AM
Thanks mhunter for pointing out to the fact that "we could port it to CRM 2013, the API 's are similar but there are datatype changes, with some changes this is totally possible. ". I have successfully used it with latest versions of CRM.
Oct 6, 2015 at 11:34 AM
mfakhri09 wrote:
Thanks mhunter for pointing out to the fact that "we could port it to CRM 2013, the API 's are similar but there are datatype changes, with some changes this is totally possible. ". I have successfully used it with latest versions of CRM.
Fear can hold you prisoner. Hope can set you free