Quantcast
Channel: Microsoft Dynamics CRM Forum - Recent Threads
Viewing all articles
Browse latest Browse all 46379

Early Bound with SDK 2016

$
0
0

Hello,

I am currently trying to migrate to SDK 2016 a project using C# code essentially within plugins and SSIS projects.

I first noticed that I had to change connection process because it was using a class named CRMConnection witch is no more provided in new sdk.

And then I came across another problem. Our projects uses early bound as well and when trying to cast a generic entity into an earlybound entity, I get errors.

For example, when calling the following method, I receive the exception : Method Microsoft.Xrm.Sdk.Entity.ToEntity: type argument 'XXXXXXX.Crm.Cliper.nov_datainterface' violates the constraint of type parameter 'T (XXXX replaces customer's name in my namespace)

Please find the code of the called method :

private nov_datainterface GetDataInterfaceByName(string name)
{
QueryExpression query = new QueryExpression(nov_datainterface.EntityLogicalName);
query.Criteria.AddCondition("nov_name", ConditionOperator.Equal, name);
var result = OrgService.RetrieveMultiple(query);
if (result != null&& result.Entities != null&& result.Entities.Count > 0)
return result[0].ToEntity<nov_datainterface>();
returnnull;

}

I think that this method of the Entity class does not work anymore : public T ToEntity<T>() where T : Entity;

This works well with SDK 2015.

Any helps will be appreciated. I tried different ways to cast my custom entity fro an a an entity class but I was not able to find anything which works.

I am also wondering who many time the current code (actually working fine with 2015 SDK) will be supported. Any replies on that point will be appreciated either.

Best regards,

Emmanuel Barache


Viewing all articles
Browse latest Browse all 46379

Trending Articles



<script src="https://jsc.adskeeper.com/r/s/rssing.com.1596347.js" async> </script>