Пример #1
0
        //VERSIONCHECK 7.1.0.0
        protected static T Retrieve_AltKey <T>(IOrganizationService service, KeyAttributeCollection keys, params Expression <Func <T, object> >[] attributes) where T : Entity
        {
            var req = new RetrieveRequest();

            req.Target    = new EntityReference(Activator.CreateInstance <T>().LogicalName, keys);
            req.ColumnSet = XrmExtensions.GetColumnSet(attributes);
            try {
                return((service.Execute(req) as RetrieveResponse)?.Entity?.ToEntity <T>());
            } catch (System.ServiceModel.FaultException) {
                return(null);
            }
        }
Пример #2
0
 public U Load <T, U>(T entity, Expression <Func <T, U> > loaderFunc) where T : Entity
 {
     LoadProperty(entity, XrmExtensions.GetMemberName(loaderFunc));
     return(loaderFunc.Compile().Invoke(entity));
 }