Beispiel #1
0
 //public void RegisterFactor<Contract, T>(TransactionFactor<Contract, T> factor) where Contract : ITransactionSupport
 //{
 //    TransactionFactors.Add(factor);
 //}
 public void RegisterEntityFactor(string ProviderName, Func<IEntityRequestProcess, Action<Action<IEntityRequestProcess, EntityPostRequest>>> func)
 {
     IEntityRequestProcess orderProcessor = Actor.Public.BuildEntityProcessor(ProviderName);
     TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>> orderFactor = new TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>>(orderProcessor);
     orderFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) =>
     {
         contract.UpdateEntity(request);
     };
     orderFactor.Action = func(orderProcessor);
     this.RegisterFactor(orderFactor);
 }
Beispiel #2
0
        static void RegisterFactor_UserState(BizTransaction transaction, BzureUser user)
        {
            IEntityRequestProcess userStateProcessor = Actor.Public.BuildEntityProcessor("SecurityApp");
            TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>> userStateFactor = new TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>>(userStateProcessor);
            userStateFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) =>
            {
                contract.UpdateEntity(request);
            };

            userStateFactor.Action = (Action<IEntityRequestProcess, EntityPostRequest> action) =>
            {
                EntityPostRequest OrderRequest = BuilderUserStateRequest(user);
                action(userStateProcessor, OrderRequest);
            };

            transaction.RegisterFactor(userStateFactor);
        }
Beispiel #3
0
        static void RegisterFactor_DeleteDroits(BizTransaction transaction, string RoleID)
        {
            IEntityRequestProcess deleteRoleDroitsProcessor = Actor.Public.BuildEntityProcessor("SecurityApp");
            TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>> deleteRoleDroitsFactor = new TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>>(deleteRoleDroitsProcessor);
            deleteRoleDroitsFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) =>
            {
                contract.UpdateEntity(request);
            };

            deleteRoleDroitsFactor.Action = (Action<IEntityRequestProcess, EntityPostRequest> action) =>
            {

                EntityPostRequest deleteRoleDroitRequest = BuilddeleteRoleDroitsRequest(RoleID);
                action(deleteRoleDroitsProcessor, deleteRoleDroitRequest);
            };

            transaction.RegisterFactor(deleteRoleDroitsFactor);
        }
        static void RegisterFactor_AddNewDroits(BizTransaction transaction, string ResourceName, DroitResource[] droits)
        {
            IEntityRequestProcess addDroitsProcessor = Actor.Public.BuildEntityProcessor("SecurityApp");
            TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>> addDroitsFactor = new TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>>(addDroitsProcessor);
            addDroitsFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) =>
            {
                contract.UpdateEntity(request);
            };

            addDroitsFactor.Action = (Action<IEntityRequestProcess, EntityPostRequest> action) =>
            {
                foreach (DroitResource droit in droits)
                {
                    EntityPostRequest addDroitRequest = BuildaddDroitRequest(ResourceName, droit);
                    action(addDroitsProcessor, addDroitRequest);
                }
            };

            transaction.RegisterFactor(addDroitsFactor);
        }
Beispiel #5
0
        static void RegisterFactor_DeleteRoles(BizTransaction transaction, BzureUser user, string[] oldRoles)
        {
            IEntityRequestProcess deleteRolesProcessor = Actor.Public.BuildEntityProcessor("SecurityApp");
            TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>> deleteRolesFactor = new TransactionFactor<IEntityRequestProcess, Action<IEntityRequestProcess, EntityPostRequest>>(deleteRolesProcessor);
            deleteRolesFactor.ActionBody = (IEntityRequestProcess contract, EntityPostRequest request) =>
            {
                contract.UpdateEntity(request);
            };

            deleteRolesFactor.Action = (Action<IEntityRequestProcess, EntityPostRequest> action) =>
            {
                foreach (string roleid in oldRoles)
                {
                    EntityPostRequest deleteRoleRequest = BuilddeleteRoleRequest(user.UserID.ToString(), roleid);
                    action(deleteRolesProcessor, deleteRoleRequest);
                }
            };

            transaction.RegisterFactor(deleteRolesFactor);
        }