Beispiel #1
0
        public void EntityReference_to_entity()
        {
            var reference = new EntityReference("entity", Guid.NewGuid());
            var entity    = reference.ToEntity();

            Assert.Equal(reference.LogicalName, entity.LogicalName);
            Assert.Equal(reference.Id, entity.Id);
        }
Beispiel #2
0
 public static T ToProxy <T>(this EntityReference reference) where T : EntityProxy
 {
     if (reference == null)
     {
         return(null);
     }
     return(reference.ToEntity().ToProxy <T>());
 }
Beispiel #3
0
        public void ToEntityTest()
        {
            // arrange
            var er = new EntityReference("account", Guid.NewGuid());

            // act
            var entity = er.ToEntity();

            // assert
            Assert.AreEqual(er, entity.ToEntityReference(), "Entity References Do Not Match");
        }
        /// <summary>
        ///     Update the approval request with the action that was taken.
        /// </summary>
        /// <param name="context">
        ///     The local plugin context.
        /// </param>
        /// <param name="approvalrequestReference">
        ///     The approval request <see cref="EntityReference" />.
        /// </param>
        /// <param name="actionTaken">
        ///     The action <see cref="EntityReference" />.
        /// </param>
        internal static void UpdateApprovalRequest(
            ILocalPluginContext context,
            EntityReference approvalrequestReference,
            EntityReference actionTaken)
        {
            var approvalrequest = approvalrequestReference.ToEntity();

            approvalrequest["fdbzap_ar_actiontaken"]   = actionTaken;
            approvalrequest["fdbzap_ar_actiontakenon"] = context.PluginExecutionContext.OperationCreatedOn;
            approvalrequest["statuscode"] = new OptionSetValue(4 /* Action Taken */);
            context.OrganizationService.Update(approvalrequest);
        }
Beispiel #5
0
        public static T ToEntity <T>(this EntityReference reference) where T : Entity
        {
            _ = reference ?? throw new ArgumentNullException(nameof(reference));

            return(reference.ToEntity().ToEntity <T>());
        }
Beispiel #6
0
 public static T ToEntity <T>(this EntityReference reference) where T : Entity
 {
     return(reference.ToEntity().ToEntity <T>());
 }