AXForum  
Вернуться   AXForum > Microsoft Dynamics CRM > Dynamics CRM: Blogs
All
Забыли пароль?
Зарегистрироваться Правила Справка Пользователи Сообщения за день Поиск

 
 
Опции темы Поиск в этой теме Опции просмотра
Старый 11.02.2013, 13:11   #1  
Blog bot is offline
Blog bot
Участник
 
25,631 / 848 (80) +++++++
Регистрация: 28.10.2006
dynamics-coe: Building Dynamics CRM Applications for Windows 8 – Practical Approaches
Источник: http://blogs.msdn.com/b/dynamics-coe...pproaches.aspx
==============

Introduction

We are living in the age of “apps”. A quick search on internet will show that there are close to 15,000 apps registered in Windows 8 marketplace while Android is sprinting ahead with approximately 600,000 aps and Apple will reach record 1 million anytime now. We have huge opportunity in this space.

The Microsoft Dynamics CRM is also evangelizing apps for Windows 8. As per official communication, the Windows 8 app for Dynamics CRM 2011 will be available by mid of 2013. In addition, you can also build your custom app which sources data from Dynamics CRM. I am sure you will come across business scenario (different looks and feel app, app leveraging old versions 3.0/4.0 CRM etc.) where you need to build custom Windows 8 apps for Dynamics CRM.

This article is focused to discuss approaches to integrate Dynamics CRM in Windows 8 apps and pros-cons associated with them.

Challenges

If you try to use CRM SDK with Windows 8 app, you encounter loads of build errors because CRM SDK and Windows 8 app use two different platforms which are not compatible with each other. The CRM SDK classes are built with .Net Framework 4.0 as target while Windows 8 apps use “.NET for Windows Store Apps”. You find the same type of errors whether using early binding or late binding methods.

Solutions

So, how do we build Windows 8 apps which can talk to Dynamics CRM? There are roughly three approaches which we can take – each with their set of pros and cons.
  • Use WinRt compatible CRM Libraries
The Microsoft Dynamics Team has developed WinRt compatible CRM libraries (WinRt.Microsoft.Crm.Sdk.Proxy and WinRt.Microsoft.Xrm.Sdk) which you can use in Windows 8 app. Right now, the libraries are in pre-released state so you can download the code of the libraries along with a sample using them. I presume that the WinRt SDK will be officially released with the release Windows 8 client for Dynamics CRM. You can download WinRt compatible Libraries and sample from the following link –

http://download.microsoft.com/downlo...RMSLSample.zip

Pros

Cons

The SDK is the way to go as it will be integral
part of CRM release when it happens.



Works with CRM Online (Live and Office 365) ,
Claim Based and IFD deployment



Does not work with CRM on-premises deployments using
Active Directory authentication. [at present]



It is currently in sample stage only.



Will not work with old versions of Dynamics CRM (4.0
and 3.0).


  • Use Bridge WCF service
This is a simple approach which works with the current release of CRM SDK. It uses a WCF service as an intermediate service to normalize platform compatibility between CRM SDK and Windows 8 app. The following are the high level steps to use intermediate service –


  • Create a WCF Services project. Set target framework as .NET 4.0. It is important because the WCF service will use CRM SDK which is .NET 4.0 based.
  • As per business need, create operations (methods) in WCF Service. Use data contracts and parameters which are compatible with “.NET for Windows Store Apps”. In my personal experience, I used native types (STRING, INT etc.), collections and also data classes without any hassles. Please use the following link to see what data types are compatible - http://msdn.microsoft.com/en-GB/libr.../br230232.aspx
  • In WCF operations or methods, use CRM SDK APIs to implement the method. You can use both early and late binding way of coding as per your comfort.
  • Finally, reference this WCF service in Windows 8 app and make calls to operations. If you are new to this, please refer the following links -
http://msdn.microsoft.com/en-us/library/hh556233.aspx

http://www.tapanila.net/consuming-wc...ith-windows-8/



Pros

Cons

Simple to use. Works with current release of CRM
SDK.



Works with CRM Online (Live and Office 365), IFD
deployment and On-Premise using Windows Authentication



Possible to make calls to old versions (3.0 and
4.0) of Dynamics CRM.



More development effort due to development of
intermediate WCF method.



You have to plan for deployment of intermediate WCF
service on some box. Overhead deployment task.



After the release of CRM SDK for Windows 8 App, this
approach should not be used unless talking to old versions (3.0, 4.0) of
Dynamics CRM.


  • Tweak Proxy Class in Early Binding
This approach also uses current release of CRM SDK but works only with early binding method. In brief, you create proxy for CRM web service and then change proxy class code to make it compatible with Windows 8 apps. Here are the steps –


  • Use CrmSvUtil utility to create proxy class for CRM Web Service
  • Include proxy class in your Windows 8 app project. When you build the project it will throw close to 500 errors in proxy class due to platform in-compatibility between Windows 8 app and proxy class framework APIs.
  • In proxy class, most of the errors are related to “System.ComponentModel” class which does not support members like INotifyPropertyChanging, PropertyChangingEventHandler etc. in “.NET for Windows Store Apps”.
  • You need to perform marathon task of manually removing and commenting/disabling these member usage and related code in proxy class.
Note: Deleting these reference will have no negative impact on the functionality.


  • Once all the references are deleted, compile the code. After successful compilation, you are good to use this proxy class like you do in normal .NET client.
  • It is advisable to include proxy class in Portable Class Library (PCL - targeting .NET Framework 4.0 and above) project in place of Windows 8 client project directly. The PCL project then can be referenced in Windows 8 client project. Please refer the following link to learn more about PCL - http://msdn.microsoft.com/en-us/library/gg597391.aspx
  • There is a way to generate smaller proxy class by generating only those entities which are required. It simplifies things because then clean-up is performed on a smaller code. Please check the following link for the same - http://erikpool.blogspot.co.uk/2011/...ties-with.html

Pros

Cons

Simple to use. Use early binding and strong data types.



Can leverage Event-based Asynchronous Pattern (EAP) – async /await in Windows 8.



Works with CRM Online (Live and Office 365), IFD
deployment and On-Premise using Windows Authentication



Lengthy clean-up task. If proxy is regenerated due to
change in entity metadata then clean-up has to be performed each time.



Would recommend as intermediate approach till the CRM
SDK for WinRt gets released.



Will not work with old versions of Dynamics CRM.



Summary

You have choices to use the approach you want. I would recommend using CRM SDK for WinRt when it is released. Till that happens, you can choose between approach 2 and 3. The approach 2 (Bridge Service) has advantage to work with old CRM versions as well. Hope you find this article useful.



Brajendra,




Источник: http://blogs.msdn.com/b/dynamics-coe...pproaches.aspx
__________________
Расскажите о новых и интересных блогах по Microsoft Dynamics, напишите личное сообщение администратору.
 

Похожие темы
Тема Автор Раздел Ответов Посл. сообщение
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 12 Blog bot Dynamics CRM: Blogs 0 30.01.2013 01:11
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 10 Blog bot Dynamics CRM: Blogs 0 17.08.2012 03:27
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 7 Blog bot Dynamics CRM: Blogs 0 27.03.2012 02:11
crminthefield: Podcast and Overview: Microsoft Dynamics CRM 2011 Update Rollup 4 Blog bot Dynamics CRM: Blogs 0 24.09.2011 01:16
CRM DE LA CREME! Configuring Microsoft Dynamics CRM 4.0 for Internet-facing deployment Blog bot Dynamics CRM: Blogs 0 18.08.2009 11:05

Ваши права в разделе
Вы не можете создавать новые темы
Вы не можете отвечать в темах
Вы не можете прикреплять вложения
Вы не можете редактировать свои сообщения

BB коды Вкл.
Смайлы Вкл.
[IMG] код Вкл.
HTML код Выкл.
Быстрый переход

Рейтинг@Mail.ru
Часовой пояс GMT +3, время: 11:38.