Exemple #1
0
        /// <summary>
        /// Safely removes a promitive contract property
        /// </summary>
        /// <param name="contract">A contract that holds the property</param>
        /// <param name="property">The property</param>
        public static void RemoveSafely(this EditorContract contract, PrimitiveContractProperty property)
        {
            if (contract == null)
            {
                throw new ArgumentNullException(nameof(contract));
            }

            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }

            //Remove all risks
            contract.AnalyzeIntegrityOf(property).ResolveDeleteRisks();

            //Remove this
            var entity = contract.DataModel.GetEntityOf(property);

            //entity.PrimitiveProperties.Remove(property);
            entity.RemoveProperty(property);
        }
        public void Setup()
        {
            property1 = new PrimitiveContractProperty();
            property4 = new PrimitiveContractProperty();
            entity1   = new ContractEntity()
            {
                PrimitiveProperties = new List <PrimitiveContractProperty>()
                {
                    property1,
                    property4
                }
            };

            property2 = new ReferenceContractProperty()
            {
                Entity = entity1
            };
            property5 = new ReferenceContractProperty()
            {
                Entity = entity1
            };

            entity2 = new ContractEntity()
            {
                ReferenceProperties = new List <ReferenceContractProperty>()
                {
                    property2,
                    property5
                }
            };

            entity3 = new ContractEntity()
            {
            };


            property6 = new ReferenceContractProperty();
            property7 = new ReferenceContractProperty();
            entity4   = new ContractEntity()
            {
                ReferenceProperties = new List <ReferenceContractProperty>()
                {
                    property6
                }
            };
            entity5 = new ContractEntity()
            {
                ReferenceProperties = new List <ReferenceContractProperty>()
                {
                    property7
                }
            };
            property6.Entity = entity5;
            property7.Entity = entity4;

            contract = new EditorContract()
            {
                DataModel = new ContractDataModel()
                {
                    Entities = new List <ContractEntity>()
                    {
                        entity1,
                        entity2,
                        entity3,
                        entity4,
                        entity5
                    },
                },
                Processes = new ContractProcesses()
                {
                    Main = new ContractProcess()
                    {
                        ProcessElements = new List <ContractProcessElement>()
                        {
                            new ContractUserActivity()
                            {
                                Form = new ContractForm()
                                {
                                    Fields = new List <ContractFormField>()
                                    {
                                        new ContractFormField()
                                        {
                                            PropertyBinding = new ContractPropertyBinding()
                                            {
                                                Property = property4
                                            }
                                        },
                                        new ContractFormField()
                                        {
                                            PropertyBinding = new ContractPropertyBinding()
                                            {
                                                Property = property5
                                            }
                                        }
                                    }
                                }
                            }
                        }
                    }
                }
            };
        }
Exemple #3
0
 public override async Task DeletePropertyAsync(int index)
 {
     propertyToDelete       = Entity.PrimitiveProperties[index];
     deletePropertyAnalysis = Contract.AnalyzeIntegrityOf(propertyToDelete);
     await deleteDialogWindow.OpenAsync();
 }
Exemple #4
0
        public static ContractIntegrityAnalysisResult AnalyzeIntegrityOf(this EditorContract contract, PrimitiveContractProperty property)
        {
            if (contract == null)
            {
                throw new ArgumentNullException(nameof(contract));
            }

            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }

            var deleteRisks = contract.AnalyzeDeleteRisksOf(property);

            return(new ContractIntegrityAnalysisResult(deleteRisks));
        }
Exemple #5
0
        //--------------------------------------------------
        //               PRIMITIVE PROPERTY
        //--------------------------------------------------
        public static void AddSafely(this EditorContract contract, ContractEntity entity, PrimitiveContractProperty property)
        {
            if (contract == null)
            {
                throw new ArgumentNullException(nameof(contract));
            }

            if (entity == null)
            {
                throw new ArgumentNullException(nameof(entity));
            }

            if (property == null)
            {
                throw new ArgumentNullException(nameof(property));
            }

            //entity.PrimitiveProperties.Add(property);
            entity.AddProperty(property);
        }