예제 #1
0
        private Guid CreateRepositoryMethod(
            GenericManager genericManager,
            string methodName,
            RepositoryMethod.RepositoryMethodType type,
            MethodParameter[] inputParameters,
            MethodParameter outputParameter)
        {
            var content = new RepositoryMethodContent();

            foreach (var item in inputParameters)
            {
                item.Direction = MethodParameter.ParameterDirection.Input;
            }

            if (outputParameter != null)
            {
                outputParameter.Direction = MethodParameter.ParameterDirection.Output;
                content.Parameters.Add(outputParameter);
            }
            content.Parameters.AddRange(inputParameters);

            var method = new RepositoryMethod()
            {
                Name         = methodName,
                RepositoryId = RepositoryEntityReference,
                Type         = new OptionSetValue((int)type),
                Content      = JsonParserService.StringfyWithTypes(content),
            };

            return(genericManager.Create(RepositoryMethod.LogicalName, Entity.EntityToDictionary(method)));
        }
예제 #2
0
        private Guid CreateDefaultZeroInputsViewRepositoryMethod(GenericManager genericManager, string methodName)
        {
            var content = new RepositoryMethodContent()
                          .AddDefaultOutputViewParameter();
            var method = new RepositoryMethod()
            {
                Name         = methodName,
                Type         = new OptionSetValue((int)RepositoryMethod.RepositoryMethodType.View),
                RepositoryId = RepositoryEntityReference,
                Content      = JsonParserService.StringfyWithTypes(content),
            };

            return(genericManager.Create(RepositoryMethod.LogicalName, Entity.EntityToDictionary(method)));
        }