private static DataParameterModel DictionaryToUseCaseParameterModel(Dictionary <string, object> values) { DataParameterModel parameter = new DataParameterModel(); if (CheckDictionaryContainsKey(values, Definitions.UseCaseEditorDefinitions.UseCaseModelAttibutes.Type)) { parameter.Type = DataParameter.ParseInputType( (string)values[Definitions.UseCaseEditorDefinitions.UseCaseModelAttibutes.Type]); } if (CheckDictionaryContainsKey(values, Definitions.UseCaseEditorDefinitions.UseCaseModelAttibutes.Name)) { parameter.Name = (string)values[Definitions.UseCaseEditorDefinitions.UseCaseModelAttibutes.Name]; } if (CheckDictionaryContainsKey(values, Definitions.UseCaseEditorDefinitions.UseCaseModelAttibutes.DictionaryKeyType)) { parameter.DictionaryKeyType = DataParameter.ParseInputType( (string)values[Definitions.UseCaseEditorDefinitions.UseCaseModelAttibutes.DictionaryKeyType]); } if (CheckDictionaryContainsKey(values, Definitions.UseCaseEditorDefinitions.UseCaseModelAttibutes.DictionaryValueType)) { parameter.DictionaryValueType = DataParameter.ParseInputType( (string)values[Definitions.UseCaseEditorDefinitions.UseCaseModelAttibutes.DictionaryValueType]); } if (CheckDictionaryContainsKey(values, Definitions.UseCaseEditorDefinitions.UseCaseModelAttibutes.EnumerableType)) { parameter.EnumerableType = DataParameter.ParseInputType( (string)values[Definitions.UseCaseEditorDefinitions.UseCaseModelAttibutes.EnumerableType]); } if ((int)parameter.Type <= 0) { throw new InvalidCastException($"UseCaseParameterModel requires at least Type paramater"); } if (string.IsNullOrEmpty(parameter.Name)) { throw new InvalidCastException($"UseCaseParameterModel requires at least Name paramater"); } if (parameter.Type == DD.DomainGenerator.Definitions.DomainInputType.Enumerable) { if ((int)parameter.EnumerableType <= 0) { throw new InvalidCastException($"UseCaseParameterModel with Type=Enumerable requires EnumerableType paramater"); } } if (parameter.Type == DD.DomainGenerator.Definitions.DomainInputType.Dictionary) { if ((int)parameter.DictionaryKeyType <= 0) { throw new InvalidCastException($"UseCaseParameterModel with Type=Dictionary requires DictionaryKeyType paramater"); } else if ((int)parameter.DictionaryValueType <= 0) { throw new InvalidCastException($"UseCaseParameterModel with Type=Dictionary requires DictionaryValueType paramater"); } } if (parameter.Type == DD.DomainGenerator.Definitions.DomainInputType.Enumerable) { parameter.DictionaryKeyType = 0; parameter.DictionaryValueType = 0; } else if (parameter.Type == DD.DomainGenerator.Definitions.DomainInputType.Dictionary) { parameter.EnumerableType = 0; } return(parameter); }
private void SetUseCaseParameter(DataParameterModel data) { _viewModel.UseCaseParameter = data; }