Ejemplo n.º 1
0
        public List <CreateClassData> Make(MakeUseCaseParameter param)
        {
            var data = new List <CreateClassData>
            {
                CreateUseCase(param),
                CreateRquest(param),
                CreateResponse(param),
            };

            return(data);
        }
Ejemplo n.º 2
0
        private CreateClassData CreateResponse(MakeUseCaseParameter param)
        {
            var className      = responseName(param);
            var classNameSpace = nameSpace(param);

            var meta = new ClassMeta(classNameSpace, className);

            meta.SetupUsing().AddUsing(usingNameSpace);
            meta.SetupImplements().AddImplements("IResponse");

            var content = classFileGenerateDriver.Create(meta, Language.CSharp);

            return(new CreateClassData(
                       Path.Combine(param.ControllerName, param.ActionName),
                       className + ".cs",
                       content
                       ));
        }
Ejemplo n.º 3
0
        private CreateClassData CreateUseCase(MakeUseCaseParameter param)
        {
            var interfaceName  = "I" + param.CompleteName + "UseCase";
            var classNameSpace = nameSpace(param);

            var meta = new InterfaceMeta(classNameSpace, interfaceName);

            meta.SetupUsing().AddUsing(usingNameSpace);
            meta.SetupImplements()
            .AddImplements("IUseCase", x => x.AddGeneric(requestName(param), responseName(param)));

            var content = classFileGenerateDriver.Create(meta, Language.CSharp);

            return(new CreateClassData(
                       Path.Combine(param.ControllerName, param.ActionName),
                       interfaceName + ".cs",
                       content
                       ));
        }
Ejemplo n.º 4
0
 private string responseName(MakeUseCaseParameter param) => $"{param.CompleteName}Response";
Ejemplo n.º 5
0
 private string requestName(MakeUseCaseParameter param) => $"{param.CompleteName}Request";
Ejemplo n.º 6
0
 private string nameSpace(MakeUseCaseParameter param) => $"UseCase.{param.ControllerName}.{param.ActionName}";